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

chore(tests): Refactor tests to support easily invoking AL2023 based runtimes #7064

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from

Conversation

lucashuy
Copy link
Contributor

@lucashuy lucashuy commented May 15, 2024

Which issue(s) does this change fix?

None

Why is this change necessary?

Our Windows testing environment does not have the latest version of Docker installed inside of it, causing issues when invoking AL2023 based runtime images. This results in skipping the AL2023 based runtime tests specifically for Docker.

How does it address the issue?

Splits up the test cases that use Docker and test the new AL2023 based runtime images into two. AL2023 based tests are then marked with a pytest marker to make them easily toggle-able within the pytest command.

The two tests will be running the same testing parameters and assert conditions.

The goal at the end of this (follow up PR to address the other tests), is to remove the runtime_supported_by_docker() method, and to instead have two separate test methods marked by pytest decorators.

What side effects does this change have?

None.

Mandatory Checklist

PRs will only be reviewed after checklist is complete

  • Add input/output type hints to new functions/methods
  • Write design document if needed (Do I need to write a design document?)
  • Write/update unit tests
  • Write/update integration tests
  • Write/update functional tests if needed
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@lucashuy lucashuy marked this pull request as ready for review May 16, 2024 16:47
@lucashuy lucashuy requested a review from a team as a code owner May 16, 2024 16:47
@lucashuy lucashuy requested a review from mndeveci May 16, 2024 16:47
@lucashuy lucashuy requested a review from mildaniel May 16, 2024 16:47
@lucashuy lucashuy marked this pull request as draft May 16, 2024 16:49
@lucashuy lucashuy marked this pull request as ready for review May 16, 2024 16:50
Comment on lines -52 to -55
cache:
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml

Copy link
Contributor

Choose a reason for hiding this comment

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

out of curiosity, why did we removed the caching part here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't work for a couple of reasons:

  1. The cache works by specifying a cached directory, and file to watch to invalidate the cache. We don't have a file named appveyor.yml, so the cache will never be invalidated correctly.
  2. Its not enough to just watch the chocolatey directories as some tools we install via chocolatey dump their files in other locations. For example, we install JDK 21 via chocolatey, but the runtime is saved into C:\Program Files\..., while the binaries and chocolatey metadata is saved in the chocolatey folders. This causes a "desync" and will cause the job to fail.

We're going to disable it for now since this needs some more investigation/work before turning it back on.

@@ -523,6 +509,11 @@ class TestBuildCommand_PythonFunctions_WithoutDocker(BuildIntegPythonBase):
use_container = False

def test_with_default_requirements(self):
# lucashuy: temporarily set docker check here
# until we refactor this set of tests
if IS_WINDOWS and not SKIP_DOCKER_TESTS and not runtime_supported_by_docker(self.runtime):
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we are getting rid of runtime_supported_by_docker and using pytest.mark instead? Do we still need this function check here?

Copy link
Contributor Author

@lucashuy lucashuy May 16, 2024

Choose a reason for hiding this comment

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

This part of the code hasn't been touched yet , saving that for the next PR so that this one doesn't become too bloated in size. We'll need to keep this here for now.

I had removed the check in the base test class, but had not updated these tests yet. Hence why it suddenly appeared here.

Copy link
Contributor Author

@lucashuy lucashuy May 16, 2024

Choose a reason for hiding this comment

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

Ah, this particular check might be unecessary, let me remove it since this integ test isn't suppose to require an invoke anyways. Let me revisit the usage of this check in this PR and remove any that is not required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants