down_test.go 838 B

123456789101112131415161718192021222324252627282930313233
  1. package backend
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/docker/ecs-plugin/pkg/amazon/sdk"
  6. btypes "github.com/docker/ecs-plugin/pkg/amazon/types"
  7. "github.com/docker/ecs-plugin/pkg/compose"
  8. "github.com/golang/mock/gomock"
  9. )
  10. func TestDown(t *testing.T) {
  11. ctrl := gomock.NewController(t)
  12. defer ctrl.Finish()
  13. m := sdk.NewMockAPI(ctrl)
  14. c := &Backend{
  15. Cluster: "test_cluster",
  16. Region: "region",
  17. api: m,
  18. }
  19. ctx := context.TODO()
  20. recorder := m.EXPECT()
  21. recorder.DeleteStack(ctx, "test_project").Return(nil)
  22. recorder.GetStackID(ctx, "test_project").Return("stack-123", nil)
  23. recorder.WaitStackComplete(ctx, "stack-123", btypes.StackDelete).Return(nil)
  24. recorder.DescribeStackEvents(ctx, "stack-123").Return(nil, nil)
  25. c.Down(ctx, compose.ProjectOptions{
  26. ConfigPaths: []string{},
  27. Name: "test_project",
  28. })
  29. }