Skip to content

Conversation

hanwen-flow
Copy link
Contributor

Some random cleanups I spotted when reading over the code.

@hanwen-flow hanwen-flow force-pushed the archive-tests branch 3 times, most recently from c9b4e8d to 63b12ec Compare January 28, 2025 18:12
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

openshift-ci bot commented Jan 30, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, hanwen-flow

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

@hanwen-flow
Copy link
Contributor Author

hanwen-flow commented Feb 3, 2025

LGTM

thanks! the 'tide' check says that it still needs the 'lgtm' label.

@nalind
Copy link
Member

nalind commented Feb 3, 2025

LGTM, thanks. The package-scope "tmp" appears to be unused after these changes, might as well remove it.

@hanwen-flow
Copy link
Contributor Author

LGTM, thanks. The package-scope "tmp" appears to be unused after these changes, might as well remove it.

there are a couple of uses under TestUntarPathWithInvalidDest and below. It's for Windows, and I don't have a windows machine to do tests.

@nalind
Copy link
Member

nalind commented Feb 4, 2025

LGTM, thanks. The package-scope "tmp" appears to be unused after these changes, might as well remove it.

there are a couple of uses under TestUntarPathWithInvalidDest and below. It's for Windows, and I don't have a windows machine to do tests.

A spot-check with GOOS=windows go test -c reveals some breakage introduced by #2199 (#2246 hopes to fix it), but after working those out, I couldn't find the uses. What am I missing?

Signed-off-by: Han-Wen Nienhuys <hanwen@engflow.com>
@hanwen-flow
Copy link
Contributor Author

What am I missing?

nothing. I was confused. Sorry!

Before, the tests hardcoded filenames in a hardcoded /tmp. This
prevents parallelization, and is a security issue on multi-user
systems.

* use t.TempDir() where possible. I left the test that does something
  with Windows alone.

* use &bytes.Buffer{} as dummy io.Writer

* use os.WriteFile() to simplify createEmptyFile

* drop unused tmp global variable

Signed-off-by: Han-Wen Nienhuys <hanwen@engflow.com>
An apparent cut & paste error. Before, the test was checking Xz
another time.

Signed-off-by: Han-Wen Nienhuys <hanwen@engflow.com>
@nalind
Copy link
Member

nalind commented Feb 4, 2025

/lgtm
Thanks!

@openshift-ci openshift-ci bot added the lgtm label Feb 4, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 5f8010b into containers:main Feb 4, 2025
20 checks passed
@hanwen-flow
Copy link
Contributor Author

reveals some breakage introduced by

@nalind - shouldn't this repo have some CI setup as well? It's vendored into important other packages, but the vendoring drops the tests.

as an aside, IIUC, the tests assume they run as root. Would it be useful to add some t.Skip() or t.Fail() statements to the effect?

@nalind
Copy link
Member

nalind commented Feb 5, 2025

Ideally, CI would cover more things, yes. Tests that we know will fail without certain privileges could stand to skip themselves if they know they don't have them, and at that point, having CI ensure that they run both with and without those privileges would be helpful.

@hanwen-flow hanwen-flow deleted the archive-tests branch February 5, 2025 16:04
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.

3 participants