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

test(terraform): add assertion for terraform stdout #6040

Merged
merged 1 commit into from
May 14, 2024

Conversation

stefreak
Copy link
Member

@stefreak stefreak commented May 14, 2024

Follow-up on #6037 (This adds a missing test)

Follow-up on #6037 (This adds a missing test)
@stefreak stefreak requested review from vvagaytsev and twelvemo May 14, 2024 14:09
@stefreak stefreak enabled auto-merge May 14, 2024 14:10
@stefreak stefreak marked this pull request as draft May 14, 2024 14:10
auto-merge was automatically disabled May 14, 2024 14:10

Pull request was converted to draft

@stefreak stefreak marked this pull request as ready for review May 14, 2024 14:20
Copy link
Collaborator

@twelvemo twelvemo left a comment

Choose a reason for hiding this comment

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

👍

@@ -624,7 +624,7 @@ describe("getManifests", () => {
expect(manifests[0].spec.replicas).to.eql(3)
})
it("should log a warning if patches don't match manifests", async () => {
garden.log.root["entries"] = []
garden.log.root["entries"].length = 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a more preferred way of emptying arrays? I'm just curious :)

Copy link
Member Author

@stefreak stefreak May 14, 2024

Choose a reason for hiding this comment

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

I did this as changing the identity of the private array made the test fail in the terraform tests (I didn't quite understand why). Setting length to 0 removes all elements of the array but preserves it's identity, and to prevent others from experiencing the same thing I changed all occurrences of this "reset" code to the more reliable method preserving the identity.

Copy link
Member Author

Choose a reason for hiding this comment

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

It think it'd be less hacky if we added a "reset" method to the logger interface or implemented a helper somewhere 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the explanation! I've just looked to the official JS reference docs and it looks like it's quite a common way of emptying an array :)
So, no need to create a helper)

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we need to mutate an array without reassigning it and changing its identity, that's the way to go :)

The official docs say that the exceed elements will be removed.
That can be understood as those won't be kept by any internal reference and will become available for garbage collection :)

@stefreak stefreak added this pull request to the merge queue May 14, 2024
Copy link
Collaborator

@vvagaytsev vvagaytsev left a comment

Choose a reason for hiding this comment

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

👍

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 14, 2024
@vvagaytsev vvagaytsev added this pull request to the merge queue May 14, 2024
Merged via the queue into main with commit 32653f0 May 14, 2024
40 checks passed
@vvagaytsev vvagaytsev deleted the terraform-test-stdout-consumption branch May 14, 2024 15:27
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.

3 participants