Skip to content

Commit

Permalink
Merge 3c4293c into 5355d4e
Browse files Browse the repository at this point in the history
  • Loading branch information
kzys authored Oct 4, 2024
2 parents 5355d4e + 3c4293c commit 11ea91a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions test/preflight/apps_v2_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,12 @@ func TestErrOutput(t *testing.T) {
}
}

func TestImageLabel(t *testing.T) {
func TestImageLabel(tt *testing.T) {
t := testLogger{tt}
f := testlib.NewTestEnvFromEnv(t)
appName := f.CreateRandomAppName()

dockerfileContent := `FROM nginx:1.23.3
dockerfileContent := `FROM nginx:1.27
ENV BUILT_BY_DOCKERFILE=true
`
Expand All @@ -499,14 +500,19 @@ ENV BUILT_BY_DOCKERFILE=true
f.Fatalf("failed to write dockerfile at %s error: %v", dockerfilePath, err)
}

f.Fly("launch --org %s --name %s --region %s --now --internal-port 80 --auto-confirm", f.OrgSlug(), appName, f.PrimaryRegion())
f.Fly("deploy --label Z=ZZZ -a %s", appName)
t.Logf("Launch %s", appName)
f.Fly("launch --depot=false --org %s --name %s --region %s --now --internal-port 80 --auto-confirm", f.OrgSlug(), appName, f.PrimaryRegion())

t.Logf("Deploy %s", appName)
timestamp := time.Now().Format("2006-01-02T15:04:05")
f.Fly("deploy --depot=false -a %s --label timestamp=%s", appName, timestamp)
res := f.Fly("image show -a %s --json", appName)

var machineImages []map[string]string
res.StdOutJSON(&machineImages)
var images []map[string]string
res.StdOutJSON(&images)
t.Logf("images = %+v", images)

for _, image := range machineImages {
require.Contains(f, image["Labels"], `"Z":"ZZZ"`)
for _, image := range images {
require.Contains(f, image["Labels"], fmt.Sprintf(`"timestamp":"%s"`, timestamp))
}
}

0 comments on commit 11ea91a

Please sign in to comment.