migration_test.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2015 CoreOS, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package integration
  15. import (
  16. "github.com/coreos/etcd/pkg/types"
  17. "net"
  18. "os/exec"
  19. "testing"
  20. )
  21. func TestUpgradeMember(t *testing.T) {
  22. defer afterTest(t)
  23. m := mustNewMember(t, "integration046")
  24. newPeerListeners := make([]net.Listener, 0)
  25. newPeerListeners = append(newPeerListeners, newListenerWithAddr(t, "127.0.0.1:59892"))
  26. m.PeerListeners = newPeerListeners
  27. urls, err := types.NewURLs([]string{"http://127.0.0.1:59892"})
  28. if err != nil {
  29. t.Fatal(err)
  30. }
  31. m.PeerURLs = urls
  32. m.NewCluster = true
  33. c := &cluster{}
  34. c.Members = []*member{m}
  35. fillClusterForMembers(c.Members, "etcd-cluster")
  36. cmd := exec.Command("cp", "-r", "testdata/integration046_data/conf", "testdata/integration046_data/log", "testdata/integration046_data/snapshot", m.DataDir)
  37. err = cmd.Run()
  38. if err != nil {
  39. t.Fatal(err)
  40. }
  41. c.Launch(t)
  42. defer c.Terminate(t)
  43. clusterMustProgress(t, c.Members)
  44. }