-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: simpler docker secret code (#122)
- Loading branch information
1 parent
00ab459
commit 5da58fd
Showing
2 changed files
with
14 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,15 @@ package docker | |
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
) | ||
|
||
func Test_Secret(t *testing.T) { | ||
exp := `{"auths":{"my-registry.example:5000":{"username":"tiger","password":"pass1234","email":"[email protected]","auth":"dGlnZXI6cGFzczEyMzQ="}}}` | ||
exp := `{"auths":{"my-registry.example:5000":{"auth":"dGlnZXI6cGFzczEyMzQ=","email":"[email protected]","password":"pass1234","username":"tiger"}}}` | ||
act, err := Secret("my-registry.example:5000", "tiger", "pass1234", "[email protected]") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
if d := cmp.Diff(exp, string(act)); d != "" { | ||
t.Errorf("Secret mismatch (-want +got):\n%s", d) | ||
if exp != string(act) { | ||
t.Errorf("Secret mismatch:\nwant: %s\ngot: %s", exp, act) | ||
} | ||
} |