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

experiment/generate_tests - upgrade py2 -> py3 #13784

Merged
merged 0 commits into from
Aug 6, 2019

Conversation

clarketm
Copy link
Contributor

@clarketm clarketm commented Aug 6, 2019

Additional conversions for python2 -> python3 ( #13164 ) migration and targets experiment/generate_tests.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 6, 2019
@k8s-ci-robot k8s-ci-robot requested review from ixdy and spiffxp August 6, 2019 00:54
Copy link
Member

@spiffxp spiffxp left a comment

Choose a reason for hiding this comment

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

Can't get this to work locally, is this a problem with my setup?

With bazel:

spiffxp@spiffxp-macbookpro:test-infra (experiment-generate_tests %)$ bazel run //experiment:generate_tests -- --yaml-config-path=experiment/test_config.yaml
DEBUG: /private/var/tmp/_bazel_spiffxp/7630f8dce3b74fcdbfbd9bad8e6632e4/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:256:5: rbe_default is using checked-in configs 'struct(config_repos = [], create_cc_configs = True, create_java_configs = True, env = {"ABI_LIBC_VERSION": "glibc_2.19", "ABI_VERSION": "clang", "BAZEL_COMPILER": "clang", "BAZEL_HOST_SYSTEM": "i686-unknown-linux-gnu", "BAZEL_TARGET_CPU": "k8", "BAZEL_TARGET_LIBC": "glibc_2.19", "BAZEL_TARGET_SYSTEM": "x86_64-unknown-linux-gnu", "CC": "clang", "CC_TOOLCHAIN_NAME": "linux_gnu_x86"}, java_home = "/usr/lib/jvm/java-8-openjdk-amd64", name = "9.0.0")'
INFO: Analyzed target //experiment:generate_tests (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //experiment:generate_tests up-to-date:
  bazel-bin/experiment/generate_tests
INFO: Elapsed time: 0.585s, Critical Path: 0.37s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_spiffxp/7630f8dce3b74fcdbfbd9bad8e6632e4/execroot/io_k8s_test_infra/bazel-out/darwin-fastbuild/bin/experiment/generate_tests.runfiles/io_k8s_test_infra/experiment/generate_tests.py", line 388, in <module>
    ARGS.testgrid_output_path)
  File "/private/var/tmp/_bazel_spiffxp/7630f8dce3b74fcdbfbd9bad8e6632e4/execroot/io_k8s_test_infra/bazel-out/darwin-fastbuild/bin/experiment/generate_tests.runfiles/io_k8s_test_infra/experiment/generate_tests.py", line 361, in main
    output_dir, job_name, yaml_config['jobs'][job_name], yaml_config)
  File "/private/var/tmp/_bazel_spiffxp/7630f8dce3b74fcdbfbd9bad8e6632e4/execroot/io_k8s_test_infra/bazel-out/darwin-fastbuild/bin/experiment/generate_tests.runfiles/io_k8s_test_infra/experiment/generate_tests.py", line 330, in for_each_job
    job_config, prow_config, testgrid_config = generator.generate()
  File "/private/var/tmp/_bazel_spiffxp/7630f8dce3b74fcdbfbd9bad8e6632e4/execroot/io_k8s_test_infra/bazel-out/darwin-fastbuild/bin/experiment/generate_tests.runfiles/io_k8s_test_infra/experiment/generate_tests.py", line 181, in generate
    args.extend(get_args(self.job_name, self.common))
  File "/private/var/tmp/_bazel_spiffxp/7630f8dce3b74fcdbfbd9bad8e6632e4/execroot/io_k8s_test_infra/bazel-out/darwin-fastbuild/bin/experiment/generate_tests.runfiles/io_k8s_test_infra/experiment/generate_tests.py", line 82, in get_args
    return substitute(job_name, field.get('args', []))
  File "/private/var/tmp/_bazel_spiffxp/7630f8dce3b74fcdbfbd9bad8e6632e4/execroot/io_k8s_test_infra/bazel-out/darwin-fastbuild/bin/experiment/generate_tests.runfiles/io_k8s_test_infra/experiment/generate_tests.py", line 76, in substitute
    for line in lines]
  File "/private/var/tmp/_bazel_spiffxp/7630f8dce3b74fcdbfbd9bad8e6632e4/execroot/io_k8s_test_infra/bazel-out/darwin-fastbuild/bin/experiment/generate_tests.runfiles/io_k8s_test_infra/experiment/generate_tests.py", line 76, in <listcomp>
    for line in lines]
  File "/private/var/tmp/_bazel_spiffxp/7630f8dce3b74fcdbfbd9bad8e6632e4/execroot/io_k8s_test_infra/bazel-out/darwin-fastbuild/bin/experiment/generate_tests.runfiles/io_k8s_test_infra/experiment/generate_tests.py", line 69, in get_sha1_hash
    sha1_hash.update(data)
TypeError: Unicode-objects must be encoded before hashing

Without bazel:

spiffxp@spiffxp-macbookpro:test-infra (experiment-generate_tests %)$ python --version
Python 3.7.4
spiffxp@spiffxp-macbookpro:test-infra (experiment-generate_tests %)$ ./experiment/generate_tests.py --yaml-config-path=experiment/test_config.yaml
Traceback (most recent call last):
  File "./experiment/generate_tests.py", line 388, in <module>
    ARGS.testgrid_output_path)
  File "./experiment/generate_tests.py", line 361, in main
    output_dir, job_name, yaml_config['jobs'][job_name], yaml_config)
  File "./experiment/generate_tests.py", line 330, in for_each_job
    job_config, prow_config, testgrid_config = generator.generate()
  File "./experiment/generate_tests.py", line 181, in generate
    args.extend(get_args(self.job_name, self.common))
  File "./experiment/generate_tests.py", line 82, in get_args
    return substitute(job_name, field.get('args', []))
  File "./experiment/generate_tests.py", line 76, in substitute
    for line in lines]
  File "./experiment/generate_tests.py", line 76, in <listcomp>
    for line in lines]
  File "./experiment/generate_tests.py", line 69, in get_sha1_hash
    sha1_hash.update(data)
TypeError: Unicode-objects must be encoded before hashing

@clarketm clarketm closed this Aug 6, 2019
@clarketm clarketm force-pushed the experiment-generate_tests branch from 3dc865a to a72e112 Compare August 6, 2019 18:34
@k8s-ci-robot k8s-ci-robot merged commit a72e112 into kubernetes:master Aug 6, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clarketm

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 Aug 6, 2019
@clarketm
Copy link
Contributor Author

clarketm commented Aug 6, 2019

@spiffxp - This was fixed in #13702 with this additional line added, which resolves the error you are seeing. Please try again on master and it should work (as well as be on python3).

@fejta fejta mentioned this pull request Aug 9, 2019
17 tasks
@clarketm clarketm deleted the experiment-generate_tests branch August 24, 2019 00:42
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. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants