deis / workflow

The open source PaaS for Kubernetes.
https://deis.com/workflow/
MIT License
1.3k stars 181 forks source link

Improving CLI/SDK Testing #359

Closed Joshua-Anderson closed 8 years ago

Joshua-Anderson commented 8 years ago

Current CLI/SDK Feature Workflow:

In this proposal, the sdk runs e2e by building the CLI with the version of the SDK in the PR.

Workflow:

In the proposal, the e2e tests use the SDK instead of the cli. The CLI has fairly little logic and can be tested fairly completely against a mock http server (like we currently do for the SDK). This would allow us to check the CLI maintains session, parses command line arguments correctly, and etc.

Workflow:

vdice commented 8 years ago

I am in favor of Proposal 1 at this time, with the initial pain points of this approach hopefully inspiring tooling improvements to make the experience better.

arschles commented 8 years ago

Feedback from offline discussion:

mboersma commented 8 years ago

Just to chime in, I'm also in favor of less disruptive, less effort (1), especially since my assumption is that this type of multi-PR situation will become somewhat less common in the future.

bacongobbler commented 8 years ago

If we're going the route of option 1, we might as well not do anything. It's just as complicated to get the CLI to build with a specific SDK version than it is to manually pin to a version in glide.yaml like we already do. Essentially we'd be doing the same thing, except we're engineering this into CI and wasting release cycles. I don't think it's worth the time or effort to go that route if a simple change in glide.yaml is all it takes to effectively do all this work for us.

bacongobbler commented 8 years ago

As for this:

CI automatically points SDK version to the CLI PR (using ‘Requires’ syntax) and runs e2e. If the change requires an e2e PR, the e2e PR can point to the CLI PR and vice versa. Merge SDK PR Update SDK version in CLI PR Merge CLI PR

This already exists, so the pain points are from

Open SDK PR CI builds the CLI with this PR and runs e2e. Open CLI PR

Which is accomplished by modifying glide.yaml.

Joshua-Anderson commented 8 years ago

@bacongobbler The main thing we are working on is get one e2e running on CLI and SDK repos, and also possibly a single e2e build for the corresponding cli/sdk/e2e PR using the requires syntax, making it less painful to have to make the 3 part merges.

Joshua-Anderson commented 8 years ago

That being said, I think standalone controller SDK integration tests could be valuable, because right now as a SDK developer it is really hard to test that your changes actually work against a real cluster.

bacongobbler commented 8 years ago

As for the alternate options: I'm completely against options 2 and 3 for a couple reasons:

1) mocking out the CLI for option 2 essentially throws away our existing (and green) e2e. Not a good idea. 2) e2e for both the cli and the sdk means contributors must now come up with two implementations in the same codebase for the same problem. As if it already isn't difficult enough to get people to contribute e2e tests...

I would propose a 4th option: just write integration tests for the sdk and leave e2e alone. That way SDK devs can test their changes against their own cluster, but we don't necessarily need to validate them against any sort of 2e2 for now. Just more of "helper" tests for devs.

vdice commented 8 years ago

Initial pipeline now created in https://github.com/deis/controller-sdk-go/issues/39; closing.