Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoShaka committed Nov 4, 2024
1 parent c79c465 commit b4e12e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions lib/services/local/autoupdate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ func TestAutoUpdateServiceConfigCRUD(t *testing.T) {
var notFoundError *trace.NotFoundError
require.ErrorAs(t, err, &notFoundError)

// If we try to conditionally update a missing resource, we receive
// a CompareFailed instead of a NotFound.
var revisionMismatchError *trace.CompareFailedError
_, err = service.UpdateAutoUpdateConfig(ctx, config)
require.ErrorAs(t, err, &notFoundError)
require.ErrorAs(t, err, &revisionMismatchError)
}

// TestAutoUpdateServiceVersionCRUD verifies get/create/update/upsert/delete methods of the backend service
Expand Down Expand Up @@ -155,8 +158,11 @@ func TestAutoUpdateServiceVersionCRUD(t *testing.T) {
var notFoundError *trace.NotFoundError
require.ErrorAs(t, err, &notFoundError)

// If we try to conditionally update a missing resource, we receive
// a CompareFailed instead of a NotFound.
var revisionMismatchError *trace.CompareFailedError
_, err = service.UpdateAutoUpdateVersion(ctx, version)
require.ErrorAs(t, err, &notFoundError)
require.ErrorAs(t, err, &revisionMismatchError)
}

// TestAutoUpdateServiceInvalidNameCreate verifies that configuration and version
Expand Down
4 changes: 2 additions & 2 deletions tool/tctl/common/edit_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ func testEditAutoUpdateConfig(t *testing.T, clt *authclient.Client) {
require.NoError(t, err)

serviceClient := autoupdatev1pb.NewAutoUpdateServiceClient(clt.GetConnection())
_, err = serviceClient.CreateAutoUpdateConfig(ctx, &autoupdatev1pb.CreateAutoUpdateConfigRequest{Config: initial})
initial, err = serviceClient.CreateAutoUpdateConfig(ctx, &autoupdatev1pb.CreateAutoUpdateConfigRequest{Config: initial})
require.NoError(t, err, "creating initial autoupdate config")

editor := func(name string) error {
Expand Down Expand Up @@ -616,7 +616,7 @@ func testEditAutoUpdateVersion(t *testing.T, clt *authclient.Client) {
require.NoError(t, err)

serviceClient := autoupdatev1pb.NewAutoUpdateServiceClient(clt.GetConnection())
_, err = serviceClient.CreateAutoUpdateVersion(ctx, &autoupdatev1pb.CreateAutoUpdateVersionRequest{Version: initial})
initial, err = serviceClient.CreateAutoUpdateVersion(ctx, &autoupdatev1pb.CreateAutoUpdateVersionRequest{Version: initial})
require.NoError(t, err, "creating initial autoupdate version")

editor := func(name string) error {
Expand Down

0 comments on commit b4e12e5

Please sign in to comment.