Skip to content

Add Kokoro scripts for k8s insecure tests#26883

Merged
ericgribkoff merged 6 commits intogrpc:masterfrom
ericgribkoff:k8s_basic_kokoro
Aug 11, 2021
Merged

Add Kokoro scripts for k8s insecure tests#26883
ericgribkoff merged 6 commits intogrpc:masterfrom
ericgribkoff:k8s_basic_kokoro

Conversation

@ericgribkoff
Copy link
Copy Markdown
Contributor

No description provided.

@ericgribkoff ericgribkoff added the release notes: no Indicates if PR should not be in release notes label Aug 5, 2021
@ericgribkoff ericgribkoff requested a review from sergiitk August 5, 2021 06:05
@sergiitk
Copy link
Copy Markdown
Member

sergiitk commented Aug 5, 2021

Also: naming is hard. Not sure "Insecure" is the right way to describe it.

@ericgribkoff
Copy link
Copy Markdown
Contributor Author

Also: naming is hard. Not sure "Insecure" is the right way to describe it.

Just grpc_xds_k8s_lb tests then? Wanted to differentiate from sec tests somehow.

@sergiitk
Copy link
Copy Markdown
Member

sergiitk commented Aug 5, 2021

@ericgribkoff grpc_xds_k8s_lb sounds good! I'm planning to rename security tests at some point, to differentiate. Something like grpc_xds_k8s_security.

Comment on lines +148 to +151
run_test change_backend_service_test
run_test failover_test
run_test remove_neg_test
run_test round_robin_test
Copy link
Copy Markdown
Member

@sergiitk sergiitk Aug 9, 2021

Choose a reason for hiding this comment

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

Keep in mind this will exit after first test failure, and the rest of the tests won't run.
It's easy to make it continue, but then the exit code of this script won't be reported should any of the tests fail:

  set +e
  run_test change_backend_service_test
  run_test failover_test
  run_test remove_neg_test
  run_test round_robin_test

If we want to report the code, we need to do something like

#!/usr/bin/env bash
set -eo pipefail

run_test() {
  echo $1
  if [[ $1 == "good_test" ]]; then
    python -c 'import sys; print("success"); sys.exit(0)'
  else
    python -c 'import sys; sys.exit("fail")'
  fi
}

main() {
  errors=0
  for test in good_test bad_test good_test bad_test
  do
    local exit_code=0
    run_test $test || (( errors++ ))
  done
  echo "Failed test suites: ${errors}"
  if (( errors > 0 )); then
    exit 1
  fi
}

main "$@"

But in this case python must be the last call in run_test, so set command on line 110 must be deleted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hah, I didn't actually see the edit here and went off the original email notification only. After some (way too much...) time spent on bash, I came up with (I believe) more or less the same thing, sans the for-loop. But the error message in your snippet here is clearer, so will update to what you provided :)

@ericgribkoff ericgribkoff merged commit 5fc9821 into grpc:master Aug 11, 2021
@ericgribkoff ericgribkoff deleted the k8s_basic_kokoro branch August 11, 2021 05:26
dennycd pushed a commit to dennycd/grpc that referenced this pull request Aug 11, 2021
* Add Kokoro scripts for k8s insecure tests

* change cluster and job names

* update name in cfg

* do not exit immediately if test case fails

* better error message, loop

* fix arr
Vignesh2208 pushed a commit to Vignesh2208/grpc that referenced this pull request Aug 20, 2021
* Add Kokoro scripts for k8s insecure tests

* change cluster and job names

* update name in cfg

* do not exit immediately if test case fails

* better error message, loop

* fix arr
lidizheng pushed a commit to lidizheng/grpc that referenced this pull request Sep 23, 2021
* Add Kokoro scripts for k8s insecure tests

* change cluster and job names

* update name in cfg

* do not exit immediately if test case fails

* better error message, loop

* fix arr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release notes: no Indicates if PR should not be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants