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

Run integration tests against full agent & proxy-server apps #536

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

tallclair
Copy link
Contributor

@tallclair tallclair commented Oct 24, 2023

This PR changes the way the proxy-agent & proxy-server are run in integration tests. Previously, the tests constructed the proxy-server and agents from their internal components connected via channels. Now, the tests set up the full proxy-server & proxy-agent servers, connected over local ports (and unix sockets). This approach gives better end-to-end test coverage, and paves the way to running the test suite against out-of-process servers & agents.

Summary of the specific changes:

  • framework/proxy_server.go and framework/agent.go are overhauled to run the agent/server by their cmd/{agent,server}/app invocations.
  • small changes to cmd/{agent,server}/app to support in-process execution (mostly improvements to shutdown), and exposes some internal state to read from. Ideally, the state would be read from metrics, but since the metrics are shared globals that doesn't work for multiple in-process agents / servers. Exposing the internal state was a smaller lift.
  • Changes to the tests are mostly to support the new way of running, with some small exceptions

Sorry for the large PR, I didn't see a good way of breaking it down.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 24, 2023
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 24, 2023
@jkh52
Copy link
Contributor

jkh52 commented Nov 4, 2023

Opened #538 for test error

@cheftako
Copy link
Contributor

cheftako commented Nov 6, 2023

/test pull-apiserver-network-proxy-docker-build-amd64

@cheftako
Copy link
Contributor

cheftako commented Nov 6, 2023

Opened #538 for test error

I believe fixed with kubernetes/test-infra#31196

@cheftako
Copy link
Contributor

cheftako commented Nov 6, 2023

/test pull-apiserver-network-proxy-docker-build-arm64

@jkh52
Copy link
Contributor

jkh52 commented Nov 17, 2023

/assign

@jkh52
Copy link
Contributor

jkh52 commented Nov 17, 2023

/assign @cheftako

cmd/server/app/server.go Outdated Show resolved Hide resolved
@jkh52
Copy link
Contributor

jkh52 commented Dec 1, 2023

/approve
/hold
hold for @cheftako review and outstanding nits

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 1, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jkh52, tallclair

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 1, 2023
@@ -49,28 +49,32 @@ func NewAgentCommand(a *Agent, o *options.GrpcProxyAgentOptions) *cobra.Command
Use: "agent",
Long: `A gRPC agent, Connects to the proxy and then allows traffic to be forwarded to it.`,
RunE: func(cmd *cobra.Command, args []string) error {
return a.run(o)
stopCh := make(chan struct{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Not against the expanding the scope of the stop channel up the stack. However not seeing the value on moving it only this far? If we moved it up to main(), we could improve the graceful shutdown.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved it to here to make stopCh an argument to Run(...), so that tests can call the Run method and shutdown at the end. How does moving it to main() improve graceful shutdown? Actually, it looks like the server command explicitly installs a signal handler for graceful shutdown. Would it be better to just reuse that code here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I started to make the signal handler change, but I'd prefer to make it a separate PR to derisk this PR and keep the non-test changes minimal.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with separate PR, especially since this commit is so large.

(The server signal handler pattern seems applicable to agent. But I think we should be cautious with making changes.)

@cheftako
Copy link
Contributor

cheftako commented Dec 4, 2023

/lgtm
Happy to remove the hold but would love to give tallclair a chance to fix minor issues.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2023
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2023
@tallclair
Copy link
Contributor Author

/hold cancel

Feedback addressed, 1 open question

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 4, 2023
@jkh52
Copy link
Contributor

jkh52 commented Dec 5, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 5, 2023
@k8s-ci-robot k8s-ci-robot merged commit ab4baf8 into kubernetes-sigs:master Dec 5, 2023
6 checks passed
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", 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.

None yet

4 participants