mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 04:48:26 +08:00
ci(deps): upgrade golangci-lint (#2556)
* ci(deps): upgrade golangci-lint
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
* build(deps): removed disabled linters
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
* build(deps): go run github.com/daixiang0/gci@latest write .
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* build(deps): go run golang.org/x/tools/cmd/goimports@latest -l -w .
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* build(deps): go run github.com/bombsimon/wsl/v4/cmd...@latest -strict-append -test=true -fix ./...
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* build(deps): go run github.com/catenacyber/perfsprint@latest -fix ./...
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* build(deps): replace gomnd by mnd
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* build(deps): make gqlgen
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* build: Revert "build(deps): go run github.com/daixiang0/gci@latest write ."
This reverts commit 5bf8c42e1f.
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* build(deps): go run github.com/daixiang0/gci@latest write -s 'standard' -s default -s 'prefix(zotregistry.dev/zot)' .
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* build(deps): make gqlgen
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: wsl issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: check-log issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: gci issues
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
* fix: tests
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
---------
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
This commit is contained in:
@@ -43,9 +43,11 @@ func MakeAuthTestServer(serverKey string, unauthorizedNamespace string) *httptes
|
||||
parts := strings.Split(scope, ":")
|
||||
name := parts[1]
|
||||
actions := strings.Split(parts[2], ",")
|
||||
|
||||
if name == unauthorizedNamespace {
|
||||
actions = []string{}
|
||||
}
|
||||
|
||||
access = []auth.AccessEntry{
|
||||
{
|
||||
Name: name,
|
||||
@@ -59,6 +61,7 @@ func MakeAuthTestServer(serverKey string, unauthorizedNamespace string) *httptes
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
response.Header().Set("Content-Type", "application/json")
|
||||
fmt.Fprintf(response, `{"access_token": "%s"}`, token)
|
||||
}))
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
func MockOIDCRun() (*mockoidc.MockOIDC, error) {
|
||||
// Create a fresh RSA Private Key for token signing
|
||||
rsaKey, _ := rsa.GenerateKey(rand.Reader, 2048) //nolint: gomnd
|
||||
rsaKey, _ := rsa.GenerateKey(rand.Reader, 2048) //nolint:mnd
|
||||
|
||||
// Create an unstarted MockOIDC server
|
||||
mockServer, _ := mockoidc.NewServer(rsaKey)
|
||||
@@ -24,7 +24,8 @@ func MockOIDCRun() (*mockoidc.MockOIDC, error) {
|
||||
return http.HandlerFunc(func(response http.ResponseWriter, req *http.Request) {
|
||||
// stateVal := req.Form.Get("state")
|
||||
header := req.Header.Get("Authorization")
|
||||
parts := strings.SplitN(header, " ", 2) //nolint: gomnd
|
||||
parts := strings.SplitN(header, " ", 2) //nolint:mnd
|
||||
|
||||
if header != "" {
|
||||
if strings.ToLower(parts[0]) == "bearer" {
|
||||
req.Header.Set("Authorization", strings.Join([]string{"Bearer", parts[1]}, " "))
|
||||
|
||||
@@ -145,6 +145,7 @@ func WriteFileWithPermission(path string, data []byte, perm fs.FileMode, overwri
|
||||
if err := os.MkdirAll(filepath.Dir(path), os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
flag := os.O_WRONLY | os.O_CREATE
|
||||
|
||||
if overwrite {
|
||||
@@ -230,7 +231,7 @@ func MakeHtpasswdFileFromString(fileContent string) string {
|
||||
}
|
||||
|
||||
content := []byte(fileContent)
|
||||
if err := os.WriteFile(htpasswdFile.Name(), content, 0o600); err != nil { //nolint:gomnd
|
||||
if err := os.WriteFile(htpasswdFile.Name(), content, 0o600); err != nil { //nolint:mnd
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ func TestCopyFiles(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
|
||||
filePath := path.Join(dir, "file.txt")
|
||||
|
||||
err := os.WriteFile(filePath, []byte("some dummy file content"), 0o644) //nolint: gosec
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -81,12 +82,14 @@ func TestCopyFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
filePathTrivy := path.Join(srcDir, "_trivy", "db", "trivy.db")
|
||||
|
||||
err = os.WriteFile(filePathTrivy, []byte("some dummy file content"), 0o644) //nolint: gosec
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var index ispec.Index
|
||||
|
||||
content, err := json.Marshal(index)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -220,6 +223,7 @@ func TestCopyTestKeysAndCerts(t *testing.T) {
|
||||
// ----- /test/data doesn't exist ------
|
||||
workDir, err := os.Getwd()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() { _ = os.Chdir(workDir) }()
|
||||
|
||||
dir = t.TempDir()
|
||||
@@ -252,6 +256,7 @@ func TestGetProjectRootDir(t *testing.T) {
|
||||
Convey("GetProjectRootDir negative testing", t, func() {
|
||||
workDir, err := os.Getwd()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() { _ = os.Chdir(workDir) }()
|
||||
|
||||
err = os.Chdir(os.TempDir())
|
||||
@@ -267,9 +272,11 @@ func TestGetCredString(t *testing.T) {
|
||||
Convey("GetCredString panics", t, func() {
|
||||
passwordSize := 100
|
||||
pass := make([]byte, passwordSize)
|
||||
|
||||
for i := 0; i < passwordSize; i++ {
|
||||
pass[i] = 'Y'
|
||||
}
|
||||
|
||||
f := func() { tcommon.GetCredString("testUser", string(pass)) }
|
||||
So(f, ShouldPanicWith, bcrypt.ErrPasswordTooLong)
|
||||
})
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/phayes/freeport"
|
||||
@@ -139,7 +140,7 @@ func GetFreePort() string {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return fmt.Sprint(port)
|
||||
return strconv.Itoa(port)
|
||||
}
|
||||
|
||||
func GetBaseURL(port string) string {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@@ -42,12 +43,11 @@ func UploadImage(img Image, baseURL, repo, ref string) error {
|
||||
digest := digestAlgorithm.FromBytes(blob).String()
|
||||
|
||||
resp, err = resty.R().
|
||||
SetHeader("Content-Length", fmt.Sprintf("%d", len(blob))).
|
||||
SetHeader("Content-Length", strconv.Itoa(len(blob))).
|
||||
SetHeader("Content-Type", "application/octet-stream").
|
||||
SetQueryParam("digest", digest).
|
||||
SetBody(blob).
|
||||
Put(baseURL + loc)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -91,7 +91,7 @@ func UploadImage(img Image, baseURL, repo, ref string) error {
|
||||
|
||||
// uploading blob should get 201
|
||||
resp, err = resty.R().
|
||||
SetHeader("Content-Length", fmt.Sprintf("%d", len(cblob))).
|
||||
SetHeader("Content-Length", strconv.Itoa(len(cblob))).
|
||||
SetHeader("Content-Type", "application/octet-stream").
|
||||
SetQueryParam("digest", cdigest.String()).
|
||||
SetBody(cblob).
|
||||
@@ -151,12 +151,11 @@ func UploadImageWithBasicAuth(img Image, baseURL, repo, ref, user, password stri
|
||||
|
||||
resp, err = resty.R().
|
||||
SetBasicAuth(user, password).
|
||||
SetHeader("Content-Length", fmt.Sprintf("%d", len(blob))).
|
||||
SetHeader("Content-Length", strconv.Itoa(len(blob))).
|
||||
SetHeader("Content-Type", "application/octet-stream").
|
||||
SetQueryParam("digest", digest).
|
||||
SetBody(blob).
|
||||
Put(baseURL + loc)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -194,7 +193,7 @@ func UploadImageWithBasicAuth(img Image, baseURL, repo, ref, user, password stri
|
||||
// uploading blob should get 201
|
||||
resp, err = resty.R().
|
||||
SetBasicAuth(user, password).
|
||||
SetHeader("Content-Length", fmt.Sprintf("%d", len(cblob))).
|
||||
SetHeader("Content-Length", strconv.Itoa(len(cblob))).
|
||||
SetHeader("Content-Type", "application/octet-stream").
|
||||
SetQueryParam("digest", cdigest.String()).
|
||||
SetBody(cblob).
|
||||
|
||||
@@ -179,6 +179,7 @@ func TestUploadImage(t *testing.T) {
|
||||
user1 := "test"
|
||||
password1 := "test"
|
||||
testString1 := tcommon.GetCredString(user1, password1)
|
||||
|
||||
htpasswdPath := tcommon.MakeHtpasswdFileFromString(testString1)
|
||||
defer os.Remove(htpasswdPath)
|
||||
conf.HTTP.Auth = &config.AuthConfig{
|
||||
@@ -266,6 +267,7 @@ func TestUploadImage(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
file, err := os.Create(path.Join(layerPath, layerBlobDigest.Encoded()))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -275,11 +277,13 @@ func TestUploadImage(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
err = os.Chmod(layerPath, 0o700)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
os.RemoveAll(file.Name())
|
||||
}()
|
||||
}
|
||||
@@ -492,6 +496,7 @@ func TestInjectUploadImageWithBasicAuth(t *testing.T) {
|
||||
user := "user"
|
||||
password := "password"
|
||||
testString := tcommon.GetCredString(user, password)
|
||||
|
||||
htpasswdPath := tcommon.MakeHtpasswdFileFromString(testString)
|
||||
defer os.Remove(htpasswdPath)
|
||||
conf.HTTP.Auth = &config.AuthConfig{
|
||||
|
||||
@@ -112,12 +112,12 @@ func DateRef(year int, month time.Month, day, hour, min, sec, nsec int, loc *tim
|
||||
|
||||
func RandomDateRef(loc *time.Location) *time.Time {
|
||||
var (
|
||||
year = 1990 + mathRand.Intn(30) //nolint: gosec,gomnd
|
||||
month = time.Month(1 + mathRand.Intn(10)) //nolint: gosec,gomnd
|
||||
day = 1 + mathRand.Intn(5) //nolint: gosec,gomnd
|
||||
hour = 1 + mathRand.Intn(22) //nolint: gosec,gomnd
|
||||
min = 1 + mathRand.Intn(58) //nolint: gosec,gomnd
|
||||
sec = 1 + mathRand.Intn(58) //nolint: gosec,gomnd
|
||||
year = 1990 + mathRand.Intn(30) //nolint: gosec,mnd
|
||||
month = time.Month(1 + mathRand.Intn(10)) //nolint: gosec,mnd
|
||||
day = 1 + mathRand.Intn(5) //nolint: gosec,mnd
|
||||
hour = 1 + mathRand.Intn(22) //nolint: gosec,mnd
|
||||
min = 1 + mathRand.Intn(58) //nolint: gosec,mnd
|
||||
sec = 1 + mathRand.Intn(58) //nolint: gosec,mnd
|
||||
nsec = 1
|
||||
)
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ func (sdm MetaDBMock) GetUserAPIKeys(ctx context.Context) ([]mTypes.APIKeyDetail
|
||||
return sdm.GetUserAPIKeysFn(ctx)
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
return nil, nil //nolint:nilnil
|
||||
}
|
||||
|
||||
func (sdm MetaDBMock) AddUserAPIKey(ctx context.Context, hashedKey string, apiKeyDetails *mTypes.APIKeyDetails) error {
|
||||
|
||||
@@ -39,7 +39,7 @@ func (remote SyncRemote) GetImageReference(repo string, tag string) (types.Image
|
||||
return remote.GetImageReferenceFn(repo, tag)
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
return nil, nil //nolint:nilnil
|
||||
}
|
||||
|
||||
func (remote SyncRemote) GetContext() *types.SystemContext {
|
||||
|
||||
@@ -407,7 +407,7 @@ func (olu BaseOciLayoutUtils) GetExpandedRepoInfo(repoName string) (common.RepoI
|
||||
isSigned := olu.CheckManifestSignature(repoName, man.Digest)
|
||||
|
||||
manifestSize := olu.GetImageManifestSize(repoName, man.Digest)
|
||||
olu.Log.Debug().Msg(fmt.Sprintf("%v", man.Digest.String()))
|
||||
olu.Log.Debug().Msg(man.Digest.String())
|
||||
configSize := manifest.Config.Size
|
||||
|
||||
repoBlob2Size[man.Digest.String()] = manifestSize
|
||||
|
||||
@@ -5,6 +5,7 @@ package ociutils_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
@@ -28,10 +29,10 @@ import (
|
||||
. "zotregistry.dev/zot/pkg/test/image-utils"
|
||||
"zotregistry.dev/zot/pkg/test/mocks"
|
||||
ociutils "zotregistry.dev/zot/pkg/test/oci-utils"
|
||||
signature "zotregistry.dev/zot/pkg/test/signature"
|
||||
"zotregistry.dev/zot/pkg/test/signature"
|
||||
)
|
||||
|
||||
var ErrTestError = fmt.Errorf("testError")
|
||||
var ErrTestError = errors.New("testError")
|
||||
|
||||
func TestBaseOciLayoutUtils(t *testing.T) {
|
||||
Convey("GetImageManifestSize fail", t, func() {
|
||||
|
||||
@@ -2,7 +2,7 @@ package ociutils_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
ociutils "zotregistry.dev/zot/pkg/test/oci-utils"
|
||||
)
|
||||
|
||||
var ErrTestFail = fmt.Errorf("fail")
|
||||
var ErrTestFail = errors.New("fail")
|
||||
|
||||
func TestInitializeMetaDBErrors(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -84,12 +84,12 @@ func GenerateNotationCerts(tdir string, certName string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := tcommon.WriteFileWithPermission(keyPath, keyPEM, 0o600, false); err != nil { //nolint:gomnd
|
||||
if err := tcommon.WriteFileWithPermission(keyPath, keyPEM, 0o600, false); err != nil { //nolint:mnd
|
||||
return fmt.Errorf("failed to write key file: %w", err)
|
||||
}
|
||||
|
||||
// write self-signed certificate
|
||||
if err := tcommon.WriteFileWithPermission(certPath, certBytes, 0o644, false); err != nil { //nolint:gomnd
|
||||
if err := tcommon.WriteFileWithPermission(certPath, certBytes, 0o644, false); err != nil { //nolint:mnd
|
||||
return fmt.Errorf("failed to write certificate file: %w", err)
|
||||
}
|
||||
|
||||
@@ -114,13 +114,13 @@ func GenerateNotationCerts(tdir string, certName string) error {
|
||||
signingKeys.Keys = append(signingKeys.Keys, keySuite)
|
||||
|
||||
// Add to the trust store
|
||||
trustStorePath := path.Join(tdir, fmt.Sprintf("notation/truststore/x509/ca/%s", certName))
|
||||
trustStorePath := path.Join(tdir, "notation/truststore/x509/ca/"+certName)
|
||||
|
||||
if _, err := os.Stat(filepath.Join(trustStorePath, filepath.Base(certPath))); err == nil {
|
||||
return ErrAlreadyExists
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(trustStorePath, 0o755); err != nil { //nolint:gomnd
|
||||
if err := os.MkdirAll(trustStorePath, 0o755); err != nil { //nolint:mnd
|
||||
return fmt.Errorf("GenerateNotationCerts os.MkdirAll failed: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"zotregistry.dev/zot/pkg/api/config"
|
||||
tcommon "zotregistry.dev/zot/pkg/test/common"
|
||||
. "zotregistry.dev/zot/pkg/test/image-utils"
|
||||
signature "zotregistry.dev/zot/pkg/test/signature"
|
||||
"zotregistry.dev/zot/pkg/test/signature"
|
||||
)
|
||||
|
||||
func TestLoadNotationSigningkeys(t *testing.T) {
|
||||
@@ -135,7 +135,9 @@ func TestSignWithNotation(t *testing.T) {
|
||||
Convey("not enough permissions to access notation/localkeys dir", t, func() {
|
||||
cwd, err := os.Getwd()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() { _ = os.Chdir(cwd) }()
|
||||
|
||||
tdir := t.TempDir()
|
||||
_ = os.Chdir(tdir)
|
||||
|
||||
@@ -160,7 +162,9 @@ func TestSignWithNotation(t *testing.T) {
|
||||
Convey("error parsing reference", t, func() {
|
||||
cwd, err := os.Getwd()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() { _ = os.Chdir(cwd) }()
|
||||
|
||||
tdir := t.TempDir()
|
||||
_ = os.Chdir(tdir)
|
||||
|
||||
@@ -179,7 +183,9 @@ func TestSignWithNotation(t *testing.T) {
|
||||
Convey("error signing", t, func() {
|
||||
cwd, err := os.Getwd()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() { _ = os.Chdir(cwd) }()
|
||||
|
||||
tdir := t.TempDir()
|
||||
_ = os.Chdir(tdir)
|
||||
|
||||
@@ -205,7 +211,9 @@ func TestVerifyWithNotation(t *testing.T) {
|
||||
Convey("error parsing reference", t, func() {
|
||||
cwd, err := os.Getwd()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() { _ = os.Chdir(cwd) }()
|
||||
|
||||
tdir := t.TempDir()
|
||||
_ = os.Chdir(tdir)
|
||||
|
||||
@@ -224,7 +232,9 @@ func TestVerifyWithNotation(t *testing.T) {
|
||||
Convey("error trying to get manifest", t, func() {
|
||||
cwd, err := os.Getwd()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() { _ = os.Chdir(cwd) }()
|
||||
|
||||
tdir := t.TempDir()
|
||||
_ = os.Chdir(tdir)
|
||||
|
||||
@@ -287,7 +297,9 @@ func TestListNotarySignatures(t *testing.T) {
|
||||
Convey("error parsing reference", t, func() {
|
||||
cwd, err := os.Getwd()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() { _ = os.Chdir(cwd) }()
|
||||
|
||||
tdir := t.TempDir()
|
||||
_ = os.Chdir(tdir)
|
||||
|
||||
@@ -298,7 +310,9 @@ func TestListNotarySignatures(t *testing.T) {
|
||||
Convey("error trying to get manifest", t, func() {
|
||||
cwd, err := os.Getwd()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() { _ = os.Chdir(cwd) }()
|
||||
|
||||
tdir := t.TempDir()
|
||||
_ = os.Chdir(tdir)
|
||||
|
||||
@@ -427,7 +441,7 @@ func TestGenerateNotationCerts(t *testing.T) {
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
certName := "cert-test"
|
||||
trustStorePath := path.Join(notationDir, fmt.Sprintf("truststore/x509/ca/%s", certName))
|
||||
trustStorePath := path.Join(notationDir, "truststore/x509/ca/"+certName)
|
||||
err = os.MkdirAll(trustStorePath, 0o755)
|
||||
So(err, ShouldBeNil)
|
||||
err = os.Chmod(path.Join(notationDir, "truststore/x509"), 0o000)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
tskip "zotregistry.dev/zot/pkg/test/skip"
|
||||
)
|
||||
@@ -17,7 +17,7 @@ func TestSkipS3(t *testing.T) {
|
||||
if len(envVal) > 0 {
|
||||
defer os.Setenv(envName, envVal)
|
||||
err := os.Unsetenv(envName)
|
||||
assert.Equal(t, err, nil, "Error should be nil")
|
||||
require.NoError(t, err, "Error should be nil")
|
||||
}
|
||||
|
||||
tskip.SkipS3(t)
|
||||
@@ -30,7 +30,7 @@ func TestSkipDynamo(t *testing.T) {
|
||||
if len(envVal) > 0 {
|
||||
defer os.Setenv(envName, envVal)
|
||||
err := os.Unsetenv(envName)
|
||||
assert.Equal(t, err, nil, "Error should be nil")
|
||||
require.NoError(t, err, "Error should be nil")
|
||||
}
|
||||
|
||||
tskip.SkipDynamo(t)
|
||||
|
||||
Reference in New Issue
Block a user