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: track localImages in a new map to enable proper cleanup #133

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

pendo324
Copy link
Member

@pendo324 pendo324 commented Mar 25, 2024

Issue #, if available: See https://github.com/runfinch/finch/actions/runs/8424406162/job/23068204038?pr=825#step:10:5839

  time="2024-03-25T17:50:43Z" level=info msg="trying next host" error="failed to do request: Head \"http://localhost:51261/v2/docker/library/alpine/manifests/latest\": dial tcp [::1]:51261: connect: connection refused" host="localhost:51261"
  time="2024-03-25T17:50:43Z" level=error msg="server \"localhost:51261\" does not seem to support HTTPS" error="failed to resolve reference \"localhost:51261/docker/library/alpine:latest\": failed to do request: Head \"http://localhost:51261/v2/docker/library/alpine/manifests/latest\": dial tcp [::1]:51261: connect: connection refused"
  time="2024-03-25T17:50:43Z" level=info msg="Hint: you may want to try --insecure-registry to allow plain HTTP (if you are in a trusted network)"
  time="2024-03-25T17:50:43Z" level=fatal msg="failed to resolve reference \"localhost:51261/docker/library/alpine:latest\": failed to do request: Head \"http://localhost:51261/v2/docker/library/alpine/manifests/latest\": dial tcp [::1]:51261: connect: connection refused"
  time="2024-03-25T17:50:43Z" level=fatal msg="exit status 1"

This error occurs here because the localImages map already has the "local" entries, even though CleanupLocalRegistry was run (and on top of that, the VM's disk was completely reset, including the local registry container. This is an edge case that occurs here because the tests package is imported once, and the global state of the localImages map is preserved.

Description of changes:

  • Instead of using one map and overriding its entries, store the local entries in a new map so that CleanupLocalRegistry can reset it, and a subsequent SetupLocalRegistry can repopulate it without issue

Testing done:

  • Tested after running Setup -> Clean -> Setup (by running the exact same failing e2e test locally), and it now works

  • I've reviewed the guidance in CONTRIBUTING.md

License Acceptance

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

@pendo324 pendo324 requested a review from Shubhranshu153 March 25, 2024 20:50
@pendo324 pendo324 self-assigned this Mar 25, 2024
@pendo324 pendo324 merged commit c8a5e72 into runfinch:main Mar 25, 2024
4 checks passed
pendo324 pushed a commit that referenced this pull request Mar 25, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.7.17](v0.7.16...v0.7.17)
(2024-03-25)


### Build System or External Dependencies

* **deps:** Bump github.com/onsi/ginkgo/v2 from 2.17.0 to 2.17.1
([#132](#132))
([c55e33b](c55e33b))


### Bug Fixes

* track localImages in a new map to enable proper cleanup
([#133](#133))
([c8a5e72](c8a5e72))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Shubhranshu153 pushed a commit to Shubhranshu153/common-tests that referenced this pull request Mar 26, 2024
…h#133)

Issue #, if available: See
https://github.com/runfinch/finch/actions/runs/8424406162/job/23068204038?pr=825#step:10:5839
```
  time="2024-03-25T17:50:43Z" level=info msg="trying next host" error="failed to do request: Head \"http://localhost:51261/v2/docker/library/alpine/manifests/latest\": dial tcp [::1]:51261: connect: connection refused" host="localhost:51261"
  time="2024-03-25T17:50:43Z" level=error msg="server \"localhost:51261\" does not seem to support HTTPS" error="failed to resolve reference \"localhost:51261/docker/library/alpine:latest\": failed to do request: Head \"http://localhost:51261/v2/docker/library/alpine/manifests/latest\": dial tcp [::1]:51261: connect: connection refused"
  time="2024-03-25T17:50:43Z" level=info msg="Hint: you may want to try --insecure-registry to allow plain HTTP (if you are in a trusted network)"
  time="2024-03-25T17:50:43Z" level=fatal msg="failed to resolve reference \"localhost:51261/docker/library/alpine:latest\": failed to do request: Head \"http://localhost:51261/v2/docker/library/alpine/manifests/latest\": dial tcp [::1]:51261: connect: connection refused"
  time="2024-03-25T17:50:43Z" level=fatal msg="exit status 1"
```

This error occurs here because the localImages map already has the
"local" entries, even though `CleanupLocalRegistry` was run (and on top
of that, the VM's disk was completely reset, including the local
registry container. This is an edge case that occurs here because the
`tests` package is imported once, and the global state of the
`localImages` map is preserved.

*Description of changes:*
- Instead of using one map and overriding its entries, store the local
entries in a new map so that `CleanupLocalRegistry` can reset it, and a
subsequent `SetupLocalRegistry` can repopulate it without issue

*Testing done:*
- Tested after running Setup -> Clean -> Setup (by running the exact
same failing e2e test locally), and it now works


- [x] I've reviewed the guidance in CONTRIBUTING.md


#### License Acceptance

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

Signed-off-by: Justin Alvarez <[email protected]>
Shubhranshu153 pushed a commit to Shubhranshu153/common-tests that referenced this pull request Mar 26, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.7.17](runfinch/common-tests@v0.7.16...v0.7.17)
(2024-03-25)


### Build System or External Dependencies

* **deps:** Bump github.com/onsi/ginkgo/v2 from 2.17.0 to 2.17.1
([runfinch#132](runfinch#132))
([c55e33b](runfinch@c55e33b))


### Bug Fixes

* track localImages in a new map to enable proper cleanup
([runfinch#133](runfinch#133))
([c8a5e72](runfinch@c8a5e72))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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