Skip to content

Commit

Permalink
clean up image and container
Browse files Browse the repository at this point in the history
Signed-off-by: Ang Zhou <[email protected]>
  • Loading branch information
azhouwd committed Mar 24, 2023
1 parent 38fee41 commit 49c4f85
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions e2e/vm/finch_config_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
// is written to ~/.finch/config.json file.
var testFinchConfigFile = func(o *option.Option) {
ginkgo.Describe("finch config file", func() {
ginkgo.It("should store login credentials", func() {
ginkgo.FIt("should store login credentials", func() {
filename := "htpasswd"
registryImage := "public.ecr.aws/docker/library/registry:latest"
registryContainer := "registry"
// The htpasswd is generated by
// `finch run --entrypoint htpasswd public.ecr.aws/docker/library/httpd:2 -Bbn testUser testPassword`.
// We don't want to generate it on the fly because:
Expand All @@ -36,12 +37,14 @@ var testFinchConfigFile = func(o *option.Option) {
port := fnet.GetFreePort()
command.Run(o, "run",
"-dp", fmt.Sprintf("%d:5000", port),
"--name", "registry",
"--name", registryContainer,
"-v", fmt.Sprintf("%s:/auth", htpasswdDir),
"-e", "REGISTRY_AUTH=htpasswd",
"-e", "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm",
"-e", fmt.Sprintf("REGISTRY_AUTH_HTPASSWD_PATH=/auth/%s", filename),
registryImage)
ginkgo.DeferCleanup(command.Run, o, "rmi", registryImage)
ginkgo.DeferCleanup(command.Run, o, "rm", "-f", registryContainer)
registry := fmt.Sprintf(`localhost:%d`, port)
command.Run(o, "login", registry, "-u", "testUser", "-p", "testPassword")

Expand Down

0 comments on commit 49c4f85

Please sign in to comment.