Skip to content

Commit

Permalink
fix updater and revision tests to throw errors from child workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tlin4194 committed Oct 28, 2024
1 parent a986769 commit f9f0431
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/runatlantis/atlantis/server/neptune/workflows/internal/metrics"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/testsuite"
"go.temporal.io/sdk/workflow"
)
Expand All @@ -32,7 +31,7 @@ func (t *testCheckRunClient) CreateOrUpdate(ctx workflow.Context, deploymentID s

case assert.Equal(t.expectedT, t.expectedDeploymentID, deploymentID):
default:
return 1, temporal.NewApplicationError("failing workflow", "myType")
t.expectedT.FailNow()
}
return 1, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/runatlantis/atlantis/server/neptune/workflows/internal/deploy/revision/queue"
terraformWorkflow "github.com/runatlantis/atlantis/server/neptune/workflows/internal/deploy/terraform"
"github.com/stretchr/testify/assert"
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/testsuite"
"go.temporal.io/sdk/workflow"
)
Expand All @@ -29,8 +28,7 @@ type testCheckRunClient struct {
func (t *testCheckRunClient) CreateOrUpdate(ctx workflow.Context, deploymentID string, request notifier.GithubCheckRunRequest) (int64, error) {
ok := assert.Equal(t.expectedT, t.expectedRequest, request)
if !ok {
return 1, temporal.NewApplicationError("failing workflow", "myType")
// t.expectedT.Exit("CreateOrUpdate had unexpected request")
t.expectedT.FailNow()
}
return 1, nil
}
Expand All @@ -57,7 +55,7 @@ func (q *testQueue) SetLockForMergedItems(ctx workflow.Context, state queue.Lock
}

func (q *testQueue) IsEmpty() bool {
return q.Queue == nil || len(q.Queue) == 0
return len(q.Queue) == 0
}

func (q *testQueue) GetQueuedRevisionsSummary() string {
Expand Down Expand Up @@ -371,7 +369,7 @@ func TestEnqueue_MergeTrigger_QueueAlreadyLocked(t *testing.T) {
Title: "atlantis/deploy: root",
Sha: rev,
Repo: github.Repo{Name: "nish"},
Summary: "This deploy is locked from a manual deployment for revision [123334444555](https://github.com//nish/commit/123334444555). Unlock to proceed.\nRevisions in queue: 12333444455",
Summary: "This deploy is locked from a manual deployment for revision [123334444555](https://github.com//nish/commit/123334444555). Unlock to proceed.\nRevisions in queue: 123334444555",
Actions: []github.CheckRunAction{github.CreateUnlockAction()},
State: github.CheckRunActionRequired,
},
Expand Down

0 comments on commit f9f0431

Please sign in to comment.