Skip to content

Commit

Permalink
nydusify: fix error in go vet
Browse files Browse the repository at this point in the history
`sudo` in action will change go env, remove sudo.
In runner user, we can create file in unpacktargz-test inseted of temp/unpacktargz-test,
so don't use os.CreateTemp in archive_test.go.

Signed-off-by: Yadong Ding <ding_yadong@foxmail.com>
  • Loading branch information
Desiki-high committed Dec 25, 2023
1 parent 8d2f0e9 commit bbf7495
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ jobs:
- name: Unit Test
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin v1.54.2
sudo make -e DOCKER=false contrib-test
make -e DOCKER=false contrib-test
- name: Upload contrib coverage file
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion contrib/nydusify/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ coverage: test

clean:
rm -f cmd/nydusify
rm -f coverage.out
rm -f coverage.txt
8 changes: 5 additions & 3 deletions contrib/nydusify/pkg/utils/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ func TestPackTargzInfo(t *testing.T) {
}

func TestUnpackTargz(t *testing.T) {
file, err := os.CreateTemp("", "nydusify-test")
defer os.RemoveAll(file.Name())
err := os.MkdirAll("unpacktargz-test", 0777)
defer os.RemoveAll("unpacktargz-test")
require.NoError(t, err)
file, err := os.Create("unpacktargz-test/test-file")
require.NoError(t, err)
err = os.WriteFile(file.Name(), []byte("123456789"), 0666)
err = os.WriteFile(file.Name(), []byte("123456789"), 0777)
require.NoError(t, err)
reader, err := PackTargz(file.Name(), file.Name(), true)
require.NoError(t, err)
Expand Down

0 comments on commit bbf7495

Please sign in to comment.