Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Fix Integration Tests #129

Closed
wants to merge 1 commit into from

Conversation

ben-ng
Copy link

@ben-ng ben-ng commented Apr 26, 2018

  • Make cluster and container registry configurable via workspace status
  • Add retries so k8s operations don't flake when they time out
  • Move test helpers to their own shell script
  • Add a service.yaml for hellohttp so we can expose it for testing
  • Add service k8s_object to BUILDs so test deployments are exposed for testing
  • Fix print statements in hellogrpc servers so assertions work
  • Clean up sed changes to source files in trap so git is clean after a
    run
  • Remove incomplete todocontroller test from .travis.yml
  • Update CONTRIBUTING with information on how to run tests

@@ -0,0 +1,2 @@
build --workspace_status_command=./hack/print-workspace-status.sh
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove this file from the PR?

Copy link
Author

Choose a reason for hiding this comment

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

@philwo hmm but without it, bazel test //... won't work without explicitly specifying that parameter. That doesn't seem user-friendly to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 this is fine

@philwo
Copy link
Member

philwo commented May 1, 2018

@mattmoor Can you suggest a reviewer for this?

It looks good to me, not sure if a maintainer of rules_k8s wants to have another look.

@ben-ng ben-ng force-pushed the configurable-e2e-tests branch from 173359d to 50f909a Compare May 16, 2018 14:02
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@ben-ng ben-ng force-pushed the configurable-e2e-tests branch from 50f909a to 5cb53d4 Compare May 16, 2018 14:09
@googlebot
Copy link

CLAs look good, thanks!

- Make cluster and container registry configurable via workspace status
- Add retries so k8s operations don't flake when they time out
- Move test helpers to their own shell script
- Add a service.yaml for hellohttp so we can expose it for testing
- Add service k8s_object to BUILDs so test deployments are exposed for testing
- Fix print statements in hellogrpc servers so assertions work
- Clean up sed changes to source files in trap so git is clean after a
run
- Remove incomplete todocontroller test from .travis.yml
- Update CONTRIBUTING with information on how to run tests
@ben-ng ben-ng force-pushed the configurable-e2e-tests branch from 5cb53d4 to d0e472d Compare May 16, 2018 14:21
@ben-ng
Copy link
Author

ben-ng commented May 16, 2018

PR updated with a small fix where the e2e test helper wouldn't respect the overridden cluster argument.

Also updated CONTRIBUTING.md with a better way of running all integration tests.

@mattmoor @philwo can we please get this reviewed & merged?

Copy link
Contributor

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Thanks, some of these best practices sort of popped up after this repo came about, so it's good to see them getting applied. Some comments inline.

@@ -0,0 +1,2 @@
build --workspace_status_command=./hack/print-workspace-status.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 this is fine

- ./examples/todocontroller/e2e-test.sh py
# Commented out because this test is incomplete and doesn't pass
# TODO: Fix this test
# - ./examples/todocontroller/e2e-test.sh py
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd kind of like to see this fixed before this goes in :(


* A container registry (e.g. [Google Container Registry](https://cloud.google.com/container-registry))
* A Kubernetes cluster (e.g. [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine))
* The host you are running tests from must match the architecture of the Kubernetes nodes (i.e. you cannot run tests on MacOS if your Kubernetes nodes run Linux)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is only partially true, for Go you can add a flag to .bazelrc that will make everything cross-compile to linux/amd64 and things work fine. For Python/Node this is true :-/

(export DOCKER_REPO_OVERRIDE=gcr.io/<your-gcp-project>;
export BUILD_CLUSTER_OVERRIDE=<your-kubernetes-cluster>;
grep e2e-test .travis.yml | sed '/^\s*#/ d' | sed 's/^[ -]*//' | \
while read -r TEST_CMD; do eval "$TEST_CMD"; done)
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps instead, we should add a top-level script that Travis calls :)

function edit() {
./examples/hellogrpc/${LANGUAGE}/server/edit.sh "$1"
}

function update() {
bazel build examples/hellogrpc/${LANGUAGE}/server:staging.replace
bazel-bin/examples/hellogrpc/${LANGUAGE}/server/staging.replace
Copy link
Contributor

Choose a reason for hiding this comment

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

This was to test the .replace flow :(

Copy link
Contributor

Choose a reason for hiding this comment

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

If todocontroller comes back, we can add it there (no service)


**Requirements**

* [Node.js](https://nodejs.org/en/download/).
Copy link
Member

Choose a reason for hiding this comment

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

If we upgrade to a newer version of rules_nodejs can we remove node as a system dependency? The newer version appear to pull in node and yarn in a toolchain-like way.

@fejta
Copy link
Contributor

fejta commented Jun 26, 2018

Thanks for the PR! Will you please respond to the feedback thus far and push an update?

@fejta
Copy link
Contributor

fejta commented Jun 27, 2018

/cc @mattmoor
/assign

@ben-ng
Copy link
Author

ben-ng commented Jun 27, 2018

I'll have time to circle back and update this pull request in a few weeks. We're in the middle of building applications using our fork of rules_k8s, and I don't have the bandwidth to change two things at once.

@fejta
Copy link
Contributor

fejta commented Jul 18, 2018

Hi Ben, we replaced travis with prow for running integration tests in CI. Is this still relevant?

@ben-ng
Copy link
Author

ben-ng commented Jul 18, 2018

@fejta yes, the integration tests themselves are broken and will not pass without this PR regardless of how you ran them

@fejta
Copy link
Contributor

fejta commented Jul 18, 2018

@ben-ng
Copy link
Author

ben-ng commented Jul 18, 2018

Oh neat, that's great! It wasn't true when I created this PR.

@ben-ng ben-ng closed this Jul 18, 2018
@ben-ng ben-ng deleted the configurable-e2e-tests branch July 18, 2018 17:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants