Skip to content
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

Assert against Revision generation annotation instead of config spec #1428

Merged

Conversation

bobcatfish
Copy link
Contributor

@bobcatfish bobcatfish commented Jun 29, 2018

In #475 I removed assertions
against Configuration.Spec.Generation b/c it is a hack and not part of
the knative spec.

In #600 I updated the
conformance tests to assert against the Revision annotation which
contains the generation.

BUT THEN in #778 when I
completely re-wrote the tests to no longer use Ginkgo, I accidentally
undid both of those changes, so this commit puts them back 😅.

BONUS: I hit a case where the length of the loadbalancer ingresses was
0 and got a panic, so if that happens again we'll get an informative
error instead.

Proposed Changes

  • Re-remove assertion against Configuration.Spec.Generation in conformance tests
  • Re-add assertion against Revision generation annotation
NONE

@google-prow-robot google-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 29, 2018
@adrcunha
Copy link
Contributor

/lgtm
/hold

Holding so Jon can review.

@google-prow-robot google-prow-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Jun 29, 2018
@jonjohnsonjr
Copy link
Contributor

This will conflict quite a bit with #1420

I also don't love how this conflates readiness with the generation assertions. WDYT about just having two checks?

@bobcatfish bobcatfish force-pushed the no_generation_assertion branch from 9e74fd1 to 9cb1a0a Compare July 19, 2018 22:03
@google-prow-robot google-prow-robot removed lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 19, 2018
@bobcatfish
Copy link
Contributor Author

bobcatfish commented Jul 19, 2018

okay it took me forever but this is finally ready for another look @adrcunha @jonjohnsonjr !

I also don't love how this conflates readiness with the generation assertions. WDYT about just having two checks?

I took your advice @jonjohnsonjr let me know what you think!

@bobcatfish bobcatfish force-pushed the no_generation_assertion branch from 9cb1a0a to 896628a Compare July 19, 2018 22:10
@@ -95,6 +93,16 @@ func assertResourcesUpdatedWhenRevisionIsReady(t *testing.T, logger *zap.Sugared
if err != nil {
t.Fatalf("Revision %s did not become ready to serve traffic: %v", names.Revision, err)
}
logger.Infof("The Revision will be annotated with the generation")
err = test.CheckRevisionState(clients.Revisions, names.Revision, func(r *v1alpha1.Revision) (bool, error) {
if a, ok := r.Annotations[serving.ConfigurationGenerationAnnotationKey]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull this logic out into test/states.go?

func RevisionHasGenerationAnnotation(gen int) func(*v1alpha1.Revision) (bool, error) {
  // [98,102]
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, that's a good idea

In knative/serving#475 I removed assertions
against Configuration.Spec.Generation b/c it is a hack and not part of
the knative spec.

In knative/serving#600 I updated the
conformance tests to assert against the Revision annotation which
contains the generation.

BUT THEN in knative/serving#778 when I
completely re-wrote the tests to no longer use Ginkgo, I accidentally
undid both of those changes, so this commit puts them back 😅.

BONUS: I hit a case where the length of the loadbalancer ingresses was
0 and got a panic, so if that happens again we'll get an informative
error instead.
@bobcatfish bobcatfish force-pushed the no_generation_assertion branch from 896628a to ba0b3ad Compare July 19, 2018 22:35
// IsRevisionAtExpectedGeneration returns a function that will check if the annotations
// on the revision include an annotation for the generation and that the annotation is
// set to the expected value.
func IsRevisionAtExpectedGeneration(expectedGeneration string) func(r *v1alpha1.Revision) (bool, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay so now this is the only function in states.go that returns a function, i think im okay with that but curious what you think @jonjohnsonjr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See AllRouteTrafficAtRevision

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well nevermind then sir!

@jonjohnsonjr
Copy link
Contributor

/lgtm

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 19, 2018
@adrcunha
Copy link
Contributor

/approve

@google-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adrcunha, bobcatfish

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-prow-robot google-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 20, 2018
@bobcatfish
Copy link
Contributor Author

/hold cancel

/meow space

@google-prow-robot google-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 20, 2018
@google-prow-robot
Copy link

google-prow-robot commented Jul 20, 2018

@bobcatfish: cat image

In response to this:

/hold cancel

/meow space

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@bobcatfish
Copy link
Contributor Author

/test pull-knative-serving-integration-tests

@google-prow-robot google-prow-robot merged commit 0118ba1 into knative:master Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants