down_test.go 970 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package amazon
  2. import (
  3. "github.com/docker/ecs-plugin/pkg/amazon/mock"
  4. "github.com/docker/ecs-plugin/pkg/compose"
  5. "github.com/golang/mock/gomock"
  6. "testing"
  7. )
  8. func Test_down_dont_delete_cluster(t *testing.T) {
  9. ctrl := gomock.NewController(t)
  10. defer ctrl.Finish()
  11. m := mock.NewMockAPI(ctrl)
  12. c := &client{
  13. Cluster: "test_cluster",
  14. Region: "region",
  15. api: m,
  16. }
  17. recorder := m.EXPECT()
  18. recorder.DeleteStack("test_project").Return(nil).Times(1)
  19. c.ComposeDown(&compose.Project{
  20. Name: "test_project",
  21. }, false, false)
  22. }
  23. func Test_down_delete_cluster(t *testing.T) {
  24. ctrl := gomock.NewController(t)
  25. defer ctrl.Finish()
  26. m := mock.NewMockAPI(ctrl)
  27. c := &client{
  28. Cluster: "test_cluster",
  29. Region: "region",
  30. api: m,
  31. }
  32. recorder := m.EXPECT()
  33. recorder.DeleteStack("test_project").Return(nil).Times(1)
  34. recorder.DeleteCluster("test_cluster").Return(nil).Times(1)
  35. c.ComposeDown(&compose.Project{
  36. Name: "test_project",
  37. }, false, true)
  38. }