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

Include acceptance tests in integration tests #2242

Merged
merged 11 commits into from
Feb 3, 2025
Merged

Conversation

denik
Copy link
Contributor

@denik denik commented Jan 27, 2025

Changes

  • Include acceptance directory in integration tests. Acceptance tests will not start local server if CLOUD_ENV is set, so they become integration tests.
  • Add dependency for vendor to integration, so that CLI can be build there.
  • Implement LocalOnly option in test.toml to opt out of running acceptance tests as integration tests. Use it in certain tests that are difficult or not necessary to fix when run as integration tests.
  • Update terraform test to redact timings out.
  • Clean up .workspace.current_user from outputs of the tests.

Tests

Existing tests.

@denik denik temporarily deployed to test-trigger-is January 27, 2025 15:45 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is January 27, 2025 15:51 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is January 27, 2025 15:56 — with GitHub Actions Inactive
@denik denik force-pushed the denik/acceptance-integration branch from b6fee09 to 3284091 Compare January 27, 2025 16:16
@denik denik temporarily deployed to test-trigger-is January 27, 2025 16:16 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is January 27, 2025 20:03 — with GitHub Actions Inactive
github-merge-queue bot pushed a commit that referenced this pull request Jan 28, 2025
… utf8 (#2244)

## Changes
- Do not start replacement / comparison if file is too large or not
valid utf-8.
- This helps to prevent replacements if there is accidentally a large
binary (e.g. terraform).

## Tests
Found this problem when working on
#2242 -- the tests tried to
applied replacements on terraform binary and crashed. With this change,
an error is reported instead.
github-merge-queue bot pushed a commit that referenced this pull request Jan 28, 2025
## Changes
- If CLOUD_ENV is set to do not override with dummy value. This allows
running acceptance tests as integration tests.
- Needed for #2242

## Tests
Manually run the test suite against dogfood. `CLOUD_ENV=aws go test
./acceptance`
@denik denik force-pushed the denik/acceptance-integration branch from 53cbbee to 18e71cb Compare January 28, 2025 11:52
@denik denik temporarily deployed to test-trigger-is January 28, 2025 11:52 — with GitHub Actions Inactive
@denik denik force-pushed the denik/acceptance-integration branch from 18e71cb to d4003d7 Compare January 28, 2025 12:03
@denik denik temporarily deployed to test-trigger-is January 28, 2025 12:03 — with GitHub Actions Inactive
@denik denik force-pushed the denik/acceptance-integration branch from d4003d7 to 6b9be38 Compare January 28, 2025 13:57
@denik denik temporarily deployed to test-trigger-is January 28, 2025 13:57 — with GitHub Actions Inactive
@denik denik mentioned this pull request Jan 28, 2025
denik added a commit that referenced this pull request Jan 28, 2025
It uses workspace.profile, which is used before variables are interpolated,
which breaks when this test is run against cloud.

Needed for #2242
@denik denik temporarily deployed to test-trigger-is January 28, 2025 14:12 — with GitHub Actions Inactive
denik added a commit that referenced this pull request Jan 28, 2025
This does not work when this test is run against cloud.

Needed for #2242
denik added a commit that referenced this pull request Jan 28, 2025
This does not work when this test is run against cloud.

Needed for #2242
@denik denik force-pushed the denik/acceptance-integration branch from 6392550 to 8ad39c9 Compare January 28, 2025 14:16
@denik denik temporarily deployed to test-trigger-is January 28, 2025 14:16 — with GitHub Actions Inactive
denik added a commit that referenced this pull request Jan 28, 2025
This does not work when this test is run against cloud.

Needed for #2242
@denik denik temporarily deployed to test-trigger-is January 28, 2025 14:28 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is January 28, 2025 15:57 — with GitHub Actions Inactive
@@ -0,0 +1,12 @@
[[Repls]]
Old = '- (user_name|service_principal_name): \$USERNAME'
New = '- user_name_OR_service_principal_name: $$USERNAME'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you include a comment explaining why these replacements need to happen? Good for posterity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. For now, I've disabled bundle/templates in cloud env as there are many differences that deserve their own PR.

@denik denik force-pushed the denik/acceptance-integration branch from 65c44cc to 9971970 Compare January 29, 2025 14:17
@denik denik temporarily deployed to test-trigger-is February 2, 2025 17:31 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is February 2, 2025 17:33 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is February 2, 2025 19:02 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is February 2, 2025 19:02 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is February 2, 2025 19:06 — with GitHub Actions Inactive
@denik denik force-pushed the denik/acceptance-integration branch from 134072a to c05f339 Compare February 3, 2025 07:57
@denik denik temporarily deployed to test-trigger-is February 3, 2025 07:57 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is February 3, 2025 08:00 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is February 3, 2025 08:04 — with GitHub Actions Inactive
@denik denik force-pushed the denik/acceptance-integration branch from c96ffb2 to 5c62de0 Compare February 3, 2025 08:08
@denik denik temporarily deployed to test-trigger-is February 3, 2025 08:08 — with GitHub Actions Inactive
@denik denik marked this pull request as ready for review February 3, 2025 08:22
@denik denik requested a review from pietern February 3, 2025 08:22
@@ -37,7 +37,7 @@ commands will detect it and remind you to do so if necessary.

>>> $TERRAFORM plan -no-color
data.databricks_current_user.me: Reading...
data.databricks_current_user.me: Read complete after 0s [id=$USER.Id]
data.databricks_current_user.me: Read complete after (redacted) [id=$USER.Id]
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to this PR: why is there a test that runs TF directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well it tests that terraform installation works. By manually adding TF_LOG you can also see that local provider is read.

cloudEnv := os.Getenv("CLOUD_ENV")
if config.LocalOnly && cloudEnv != "" {
t.Skipf("Disabled via LocalOnly setting in %s (CLOUD_ENV=%s)", configPath, cloudEnv)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect that the presence of config.Server implies the local-only mode?

Copy link
Contributor Author

@denik denik Feb 3, 2025

Choose a reason for hiding this comment

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

Interesting thought. I'd rather each option to be independent, even if in practice they correlate.

However, in case of Server & LocalOnly I don't see that -- you might need some stubs to run it locally but it already works with cloud.

@denik denik added this pull request to the merge queue Feb 3, 2025
Merged via the queue into main with commit f267318 Feb 3, 2025
9 checks passed
@denik denik deleted the denik/acceptance-integration branch February 3, 2025 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants