-
-
Notifications
You must be signed in to change notification settings - Fork 957
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: simplify validateImager, validateManifester
- Loading branch information
1 parent
dade01e
commit 43aa96f
Showing
4 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package docker | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestValidateManifester(t *testing.T) { | ||
tests := []struct { | ||
use string | ||
wantError string | ||
}{ | ||
{use: "docker"}, | ||
{use: "buildx", wantError: "docker manifest: invalid use: buildx, valid options are [docker]"}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.use, func(t *testing.T) { | ||
err := validateManifester(tt.use) | ||
if tt.wantError != "" { | ||
require.EqualError(t, err, tt.wantError) | ||
return | ||
} | ||
require.NoError(t, err) | ||
}) | ||
} | ||
} |