Unset the env var before func return in Unit Test

Signed-off-by: Kay Yan <kay.yan@daocloud.io>
pull/10462/head
Kay Yan 3 years ago
parent 679e14cd21
commit 141f2dd501

@ -177,7 +177,7 @@ func (o *repoAddOptions) run(out io.Writer) error {
InsecureSkipTLSverify: o.insecureSkipTLSverify, InsecureSkipTLSverify: o.insecureSkipTLSverify,
} }
// Check If the repo name is legal // Check if the repo name is legal
if strings.Contains(o.name, "/") { if strings.Contains(o.name, "/") {
return errors.Errorf("repository name (%s) contains '/', please specify a different name without '/'", o.name) return errors.Errorf("repository name (%s) contains '/', please specify a different name without '/'", o.name)
} }

@ -137,6 +137,8 @@ func TestRepoAddCheckLegalName(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
defer ts.Stop() defer ts.Stop()
defer resetEnv()()
const testRepoName = "test-hub/test-name" const testRepoName = "test-hub/test-name"
rootDir := ensure.TempDir(t) rootDir := ensure.TempDir(t)

Loading…
Cancel
Save