forked from containers/skopeo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation and smoke tests for the new --compat-auth-file options
Signed-off-by: Miloslav Trmač <[email protected]>
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
) | ||
|
||
func TestLogin(t *testing.T) { | ||
dir := t.TempDir() | ||
authFile := filepath.Join(dir, "auth.json") | ||
compatAuthFile := filepath.Join(dir, "config.json") | ||
|
||
// Just a trivial smoke-test exercising one error-handling path. | ||
// We can’t test full operation without a registry, unit tests should mostly | ||
// exist in c/common/pkg/auth, not here. | ||
out, err := runSkopeo("login", "--authfile", authFile, "--compat-auth-file", compatAuthFile, "example.com") | ||
assertTestFailed(t, out, err, "options for paths to the credential file and to the Docker-compatible credential file can not be set simultaneously") | ||
} |
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,25 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestLogout(t *testing.T) { | ||
dir := t.TempDir() | ||
authFile := filepath.Join(dir, "auth.json") | ||
compatAuthFile := filepath.Join(dir, "config.json") | ||
|
||
// Just a trivial smoke-test exercising one error-handling path. | ||
// We can’t test full operation without a registry, unit tests should mostly | ||
// exist in c/common/pkg/auth, not here. | ||
err := os.WriteFile(authFile, []byte("{}"), 0o700) | ||
require.NoError(t, err) | ||
err = os.WriteFile(compatAuthFile, []byte("{}"), 0o700) | ||
require.NoError(t, err) | ||
out, err := runSkopeo("logout", "--authfile", authFile, "--compat-auth-file", compatAuthFile, "example.com") | ||
assertTestFailed(t, out, err, "options for paths to the credential file and to the Docker-compatible credential file can not be set simultaneously") | ||
} |
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