ccm_test.go 762 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package ccm
  2. import (
  3. "testing"
  4. )
  5. func TestCCM(t *testing.T) {
  6. if err := AllUp(); err != nil {
  7. t.Fatal(err)
  8. }
  9. status, err := Status()
  10. if err != nil {
  11. t.Fatal(err)
  12. }
  13. if host, ok := status["node1"]; !ok {
  14. t.Fatal("node1 not in status list")
  15. } else if !host.State.IsUp() {
  16. t.Fatal("node1 is not up")
  17. }
  18. NodeDown("node1")
  19. status, err = Status()
  20. if err != nil {
  21. t.Fatal(err)
  22. }
  23. if host, ok := status["node1"]; !ok {
  24. t.Fatal("node1 not in status list")
  25. } else if host.State.IsUp() {
  26. t.Fatal("node1 is not down")
  27. }
  28. NodeUp("node1")
  29. status, err = Status()
  30. if err != nil {
  31. t.Fatal(err)
  32. }
  33. if host, ok := status["node1"]; !ok {
  34. t.Fatal("node1 not in status list")
  35. } else if !host.State.IsUp() {
  36. t.Fatal("node1 is not up")
  37. }
  38. }