Skip to content

Commit

Permalink
fix: allow safe creation of prerequired resources by not providing in…
Browse files Browse the repository at this point in the history
…valid parent

In order to create a certain resource, other resources might need to be in place first.
The TestSuiteConfig's Create method should allow the developer to satisfy this precondition.
If the precondition requires creating resources from the same parent as the target resource,
we should not pass them an invalid parent. An invalid parent could fail the creation of the
prerequired resources, thus preventing the precondition for the test to be reached.
  • Loading branch information
pmarkus committed Mar 24, 2022
1 parent a55aa2b commit 5457f86
Show file tree
Hide file tree
Showing 20 changed files with 84 additions and 66 deletions.
1 change: 1 addition & 0 deletions internal/aiptest/create/parent_invalid.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var parentInvalid = suite.Test{
util.MethodCreate{
Resource: scope.Resource,
Method: createMethod,
Message: "fx.Create(fx.nextParent(t, false))",
Parent: strconv.Quote("invalid resource name"),
}.Generate(f, "_", "err", ":=")
f.P(ident.AssertEqual, "(t, ", ident.Codes(codes.InvalidArgument), ", ", ident.StatusCode, "(err), err)")
Expand Down
1 change: 1 addition & 0 deletions internal/aiptest/create/parent_missing.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var parentMissing = suite.Test{
util.MethodCreate{
Resource: scope.Resource,
Method: createMethod,
Message: "fx.Create(fx.nextParent(t, false))",
Parent: strconv.Quote(""),
}.Generate(f, "_", "err", ":=")
f.P(ident.AssertEqual, "(t, ", ident.Codes(codes.InvalidArgument), ", ", ident.StatusCode, "(err), err)")
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions proto/gen/googleapis/cloud/aiplatform/v1/job_service_aiptest.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5457f86

Please sign in to comment.