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

Fix incorrect example client checks #1169

Merged
merged 1 commit into from
Jun 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/run_example
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ do
case "${client_language}" in
rust)
rust_client_manifest="${SCRIPTS_DIR}/../examples/${EXAMPLE}/client/rust/Cargo.toml"
if [[ -d "${rust_client_manifest}" ]]; then
if [[ -f "${rust_client_manifest}" ]]; then
cargo run --release --target=x86_64-unknown-linux-musl --manifest-path="${rust_client_manifest}" -- \
--root-tls-certificate="${SCRIPTS_DIR}/../examples/certs/local/ca.pem" \
"${CLIENT_ARGS[@]-}"
Expand All @@ -125,7 +125,7 @@ do
;;
cpp)
cpp_client="./bazel-client-bin/examples/${EXAMPLE}/client/client"
if [[ -d "${cpp_client}" ]]; then
if [[ -f "${cpp_client}" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Fine for now to get things moving again, but this has a couple of confusions that it would be good to come back and fix.

  • On a minor note, cpp_client doesn't actually indicate a C++ client, it indicates a client that's built with Bazel (example: examples/translator/client/client is built from Go). This is mostly pedantry, up until the point where it isn't.
  • More significantly, this isn't checking whether there is C++ client source code available, it's checking whether there is an already-built client binary present in the directory that our build scripts happen to put Bazel output into. This means that using the -s none option in an environment that hasn't done build_example is going to skip the tests.

For the latter, I wonder if a test for "${SCRIPTS_DIR}/../examples/${EXAMPLE}/client/BUILD" would be more reliable (and would be more closely analogous to the rust) case above).

Copy link
Contributor Author

@jul-sh jul-sh Jun 18, 2020

Choose a reason for hiding this comment

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

Thanks for your comment.

I agree with you on the cpp naming, though arguably that issue is not new in this logic and preceded those changes.

My suggestion is to take inspiration from the rust runner and follow this up with another PR that changes that check & renames cpp to the more accurate bazel, alongside renaming nodejs to npm, aka the build system the scripts will use.

"${cpp_client}" "${TLS_ARGS[@]}" "${ADDITIONAL_ARGS[@]-}" "${CLIENT_ARGS[@]-}"
else
echo "The ${EXAMPLE} example does not contain a ${client_language} client. Skipping this client."
Expand Down