mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-22 06:45:03 +01:00
assert => require
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
assert "github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -40,7 +41,7 @@ func TestGetImagePullOptions(t *testing.T) {
|
||||
config.SetDir("/non-existent/docker")
|
||||
|
||||
options, err := getImagePullOptions(ctx, NewDockerPullExecutorInput{})
|
||||
assert.NoError(t, err, "Failed to create ImagePullOptions")
|
||||
require.NoError(t, err, "Failed to create ImagePullOptions")
|
||||
assert.Empty(t, options.RegistryAuth, "RegistryAuth should be empty if no username or password is set")
|
||||
|
||||
options, err = getImagePullOptions(ctx, NewDockerPullExecutorInput{
|
||||
@@ -48,7 +49,7 @@ func TestGetImagePullOptions(t *testing.T) {
|
||||
Username: "username",
|
||||
Password: "password",
|
||||
})
|
||||
assert.NoError(t, err, "Failed to create ImagePullOptions")
|
||||
require.NoError(t, err, "Failed to create ImagePullOptions")
|
||||
assert.Equal(t, "eyJ1c2VybmFtZSI6InVzZXJuYW1lIiwicGFzc3dvcmQiOiJwYXNzd29yZCJ9", options.RegistryAuth, "Username and Password should be provided")
|
||||
|
||||
config.SetDir("testdata/docker-pull-options")
|
||||
@@ -56,6 +57,6 @@ func TestGetImagePullOptions(t *testing.T) {
|
||||
options, err = getImagePullOptions(ctx, NewDockerPullExecutorInput{
|
||||
Image: "nektos/act",
|
||||
})
|
||||
assert.NoError(t, err, "Failed to create ImagePullOptions")
|
||||
require.NoError(t, err, "Failed to create ImagePullOptions")
|
||||
assert.Equal(t, "eyJ1c2VybmFtZSI6InVzZXJuYW1lIiwicGFzc3dvcmQiOiJwYXNzd29yZFxuIiwic2VydmVyYWRkcmVzcyI6Imh0dHBzOi8vaW5kZXguZG9ja2VyLmlvL3YxLyJ9", options.RegistryAuth, "RegistryAuth should be taken from local docker config")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user