Skip to content

Refactor the Configuration following #2447#2493

Merged
knative-prow-robot merged 1 commit intoknative:masterfrom
mattmoor:refactor-config-tests
Nov 16, 2018
Merged

Refactor the Configuration following #2447#2493
knative-prow-robot merged 1 commit intoknative:masterfrom
mattmoor:refactor-config-tests

Conversation

@mattmoor
Copy link
Copy Markdown
Member

This starts to factor out functional options for setting up our table tests, which reduces the verbosity a fair amount.

I've broken off Configuration from a broader set of changes in #2447 to make things a bit more manageable to review.

@knative-prow-robot knative-prow-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 14, 2018
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor

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

The pull request process is described here

Details 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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 14, 2018
Copy link
Copy Markdown
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@mattmoor: 25 warnings.

Details

In response to this:

This starts to factor out functional options for setting up our table tests, which reduces the verbosity a fair amount.

I've broken off Configuration from a broader set of changes in #2447 to make things a bit more manageable to review.

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.

"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

type BuildOption func(*unstructured.Unstructured)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported type BuildOption should have comment or be unexported. More info.

}
}

func MarkLatestCreatedFailed(msg string) ConfigOption {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported function MarkLatestCreatedFailed should have comment or be unexported. More info.

cfg.Status.SetLatestCreatedRevisionName(confignames.Revision(cfg))
}

func WithLatestReady(cfg *v1alpha1.Configuration) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported function WithLatestReady should have comment or be unexported. More info.

}
}

func WithConfigConcurrencyModel(ss v1alpha1.RevisionRequestConcurrencyModelType) ConfigOption {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported function WithConfigConcurrencyModel should have comment or be unexported. More info.

}
}

func WithGeneration(gen int64) ConfigOption {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported function WithGeneration should have comment or be unexported. More info.

}
}

func MarkActive(r *v1alpha1.Revision) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported function MarkActive should have comment or be unexported. More info.

r.Status.MarkActive()
}

func MarkContainerMissing(rev *v1alpha1.Revision) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported function MarkContainerMissing should have comment or be unexported. More info.


type K8sServiceOption func(*corev1.Service)

type EndpointsOption func(*corev1.Endpoints)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported type EndpointsOption should have comment or be unexported. More info.

}
}

func WithRevConcurrencyModel(ss v1alpha1.RevisionRequestConcurrencyModelType) RevisionOption {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported function WithRevConcurrencyModel should have comment or be unexported. More info.


type RouteOption func(*v1alpha1.Route)

type ConfigOption func(*v1alpha1.Configuration)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: exported type ConfigOption should have comment or be unexported. More info.

Copy link
Copy Markdown

@dgerd dgerd left a comment

Choose a reason for hiding this comment

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

Much easier to read. Nice work!

}), "Bogus"),
Object: cfg("validation-failure", "foo", 1234, WithConfigConcurrencyModel("Bogus"),
// Expect Revision creation to fail with the following error.
MarkRevisionCreationFailed(`invalid value "Bogus": spec.concurrencyModel`)),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks to be using cfg.Status.MarkRevisionCreationFailed(msg). I am not sure if this method is tested elsewhere, but the previous logic had some coverage of the method validating that the message is transformed and all fields are set.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My thinking is that this is a gap in configuration_types_test.go and not a gap here.

Opened: #2499

Object: cfg("need-rev-and-build", "foo", 99998, WithBuild,
// The following properties are set when we first reconcile a Configuration
// that stamps out a Revision with an existing Build.
WithLatestCreated, WithObservedGen),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same as the above comment on WithLatestCreated.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

r.Status.SetLatestCreatedRevisionName("foo")

@mattmoor mattmoor force-pushed the refactor-config-tests branch from 669a6de to 36c7083 Compare November 15, 2018 01:30
@mattmoor
Copy link
Copy Markdown
Member Author

/lint

Copy link
Copy Markdown
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@mattmoor: 1 unresolved warnings and 1 new warnings.

Details

In response to this:

/lint

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.

}
}

// WithObservedGeneration sets the observed generation of the Configuration.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Golint comments: comment on exported function WithObservedGen should be of the form "WithObservedGen ...". More info.

@mattmoor mattmoor force-pushed the refactor-config-tests branch 2 times, most recently from 9e75bcc to 5930e46 Compare November 15, 2018 01:38
}
}

// TODO(mattmoor): Ideally this could be a more generic Option and use meta.Accessor,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think this TODO is happy with the linter still...

@dgerd
Copy link
Copy Markdown

dgerd commented Nov 15, 2018

/lint

Copy link
Copy Markdown
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@dgerd: 1 unresolved warning and 0 new warning.

Details

In response to this:

/lint

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.

This starts to factor out functional options for setting up our table tests, which reduces the verbosity a fair amount.

I've broken off Configuration from a broader set of changes in knative#2447 to make things a bit more manageable to review.
@mattmoor mattmoor force-pushed the refactor-config-tests branch from 5930e46 to 0e33e0b Compare November 16, 2018 01:21
@dgerd
Copy link
Copy Markdown

dgerd commented Nov 16, 2018

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 16, 2018
@mattmoor
Copy link
Copy Markdown
Member Author

/test pull-knative-serving-integration-tests

@knative-prow-robot knative-prow-robot merged commit af4b96a into knative:master Nov 16, 2018
@mattmoor mattmoor deleted the refactor-config-tests branch November 16, 2018 02:20
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants