-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add kubebuilders validations for name length to be <= 63 #218
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #218 +/- ##
==========================================
+ Coverage 80.10% 80.26% +0.15%
==========================================
Files 27 27
Lines 3840 3840
==========================================
+ Hits 3076 3082 +6
+ Misses 610 603 -7
- Partials 154 155 +1 ☔ View full report in Codecov by Sentry. |
a87267d
to
c730655
Compare
fix: requeue the request when the dns is not assigned
Bumps [thehanimo/pr-title-checker](https://github.com/thehanimo/pr-title-checker) from 1.4.2 to 1.4.3. - [Release notes](https://github.com/thehanimo/pr-title-checker/releases) - [Commits](thehanimo/pr-title-checker@v1.4.2...v1.4.3) --- updated-dependencies: - dependency-name: thehanimo/pr-title-checker dependency-type: direct:production update-type: version-update:semver-patch ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please apply the comments to all the APIs tests.
@@ -110,8 +110,9 @@ local-unit-test: $(ENVTEST) ## Run tests. | |||
|
|||
.PHONY: integration-test | |||
integration-test: $(ENVTEST) ## Run integration tests. | |||
go install github.com/onsi/ginkgo/v2/[email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please install the ginko in the .github/workflows/unit-integration-tests.yml similar to what fleet repo does.
https://github.com/Azure/fleet/blob/main/.github/workflows/ci.yml#L47
Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Create API call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8serrors.StatusError{}))) | ||
Expect(statusErr.Status().Message).Should(ContainSubstring("metadata.name max length is 63")) | ||
}) | ||
|
||
It("should deny creating API with invalid name starting with non-alphanumeric character", func() { | ||
var name = "-abcdef-123456789-123456789-123456789-123456789-123456789" | ||
var nameStartingWithNonAlphanum = "-abcdef-123456789-123456789-123456789-123456789-123456789" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make it as a global variable, so that it can be shared between all the resources.
ctx context.Context | ||
cancel context.CancelFunc | ||
testNamespace = "testnamespace" | ||
nameWithInvalidSize = "abcdef-123456789-123456789-123456789-123456789-123456789-123456789-123456789" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please declare this varible in api_validation_integration_test.go file where you used it.
Name: testNamespace, | ||
}, | ||
} | ||
Expect(hubClient.Delete(ctx, &ns)).Should(Succeed()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expect(hubClient.Delete(ctx, &ns)).Should(Succeed()) | |
Expect(hubClient.Delete(ctx, &ns)).Should(Succeed(), failed to delete namespace) |
}, | ||
} | ||
Expect(hubClient.Create(ctx, &ns)).Should(Succeed()) | ||
Expect(hubClient.Create(ctx, &ns)).Should(Succeed(), "failed to delete namespace") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expect(hubClient.Create(ctx, &ns)).Should(Succeed(), "failed to delete namespace") | |
Expect(hubClient.Create(ctx, &ns)).Should(Succeed(), "failed to create namespace") |
@@ -133,13 +131,13 @@ var _ = Describe("Test networking v1alpha1 API validation", func() { | |||
}) | |||
|
|||
It("should allow creating API with valid name starting with alphabet character", func() { | |||
var name = "abc-123456789" | |||
var nameValid = "abc-123456789" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create the global variable nameValidStartingWithAphabet = "abc-123456789", so that we can distinguish them and reuse for all the resources.
}, | ||
}, | ||
} | ||
Expect(hubClient.Create(ctx, multiClusterServiceName)).Should(Succeed()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expect(hubClient.Create(ctx, multiClusterServiceName)).Should(Succeed()) | |
Expect(hubClient.Create(ctx, multiClusterServiceName)).Should(Succeed(), "failed to create multiClusterService") |
missed this before, feel better to add the debug information here
}, | ||
} | ||
Expect(hubClient.Create(ctx, multiClusterServiceName)).Should(Succeed()) | ||
Expect(hubClient.Delete(ctx, multiClusterServiceName)).Should(Succeed()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expect(hubClient.Delete(ctx, multiClusterServiceName)).Should(Succeed()) | |
Expect(hubClient.Delete(ctx, multiClusterServiceName)).Should(Succeed(), "failed to delete multiClusterService") |
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Requirements:
make reviewable
for basic local testHow has this code been tested
Special notes for your reviewer