mirror of
https://github.com/docker/compose.git
synced 2025-09-22 17:27:50 +02:00
Add E2E test on deploying ACR images
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
parent
04c678b099
commit
5cab129c10
@ -150,10 +150,10 @@ func (c cliRegistryHelper) autoLoginAcr(registry string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := url.Values{
|
data := url.Values{
|
||||||
"grant_type": {"access_token"},
|
"grant_type": {"access_token"},
|
||||||
"service": {registry},
|
"service": {registry},
|
||||||
"tenant": {tenantID},
|
"tenant": {tenantID},
|
||||||
"access_token": {token.AccessToken},
|
"access_token": {token.AccessToken},
|
||||||
}
|
}
|
||||||
repoAuthURL := fmt.Sprintf("https://%s/oauth2/exchange", registry)
|
repoAuthURL := fmt.Sprintf("https://%s/oauth2/exchange", registry)
|
||||||
res, err := http.Post(repoAuthURL, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
|
res, err := http.Post(repoAuthURL, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
|
||||||
|
@ -550,6 +550,24 @@ func TestRunEnvVars(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDeployACRImage(t *testing.T) {
|
||||||
|
c := NewParallelE2eCLI(t, binDir)
|
||||||
|
_, _ = setupTestResourceGroup(t, c, "runAcr")
|
||||||
|
|
||||||
|
t.Run("run", func(t *testing.T) {
|
||||||
|
cmd := c.NewDockerCmd("run", "-d", "dockerregistrygta.azurecr.io/hello-aci")
|
||||||
|
res := icmd.RunCmd(cmd)
|
||||||
|
res.Assert(t, icmd.Success)
|
||||||
|
out := strings.Split(strings.TrimSpace(res.Stdout()), "\n")
|
||||||
|
container := strings.TrimSpace(out[len(out)-1])
|
||||||
|
t.Logf("Container name: %q", container)
|
||||||
|
waitForStatus(t, c, container, "Terminated")
|
||||||
|
|
||||||
|
res = c.RunDockerCmd("logs", container)
|
||||||
|
assert.Assert(t, strings.Contains(res.Stdout(), "Hello from Docker!"))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func setupTestResourceGroup(t *testing.T, c *E2eCLI, tName string) (string, string) {
|
func setupTestResourceGroup(t *testing.T, c *E2eCLI, tName string) (string, string) {
|
||||||
startTime := strconv.Itoa(int(time.Now().Unix()))
|
startTime := strconv.Itoa(int(time.Now().Unix()))
|
||||||
rg := "E2E-" + tName + "-" + startTime
|
rg := "E2E-" + tName + "-" + startTime
|
||||||
|
Loading…
x
Reference in New Issue
Block a user