(t *testing.T)
| 149 | } |
| 150 | |
| 151 | func TestUpdateDetectsLocalImageChange(t *testing.T) { |
| 152 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) |
| 153 | defer cancel() |
| 154 | |
| 155 | registryURL := startLocalRegistry(t, ctx) |
| 156 | imageTag := registryURL + "/update-test:latest" |
| 157 | |
| 158 | buildAndPushImage(t, ctx, imageTag, "v1") |
| 159 | |
| 160 | ns, err := docker.NewNamespace("once-update-test") |
| 161 | require.NoError(t, err) |
| 162 | defer ns.Teardown(ctx, true) |
| 163 | |
| 164 | require.NoError(t, ns.EnsureNetwork(ctx)) |
| 165 | require.NoError(t, ns.Proxy().Boot(ctx, getProxyPorts(t))) |
| 166 | |
| 167 | app := deployApp(t, ctx, ns, docker.ApplicationSettings{ |
| 168 | Name: "updateapp", |
| 169 | Image: imageTag, |
| 170 | Host: "updateapp.localhost", |
| 171 | }) |
| 172 | |
| 173 | firstContainer, err := app.ContainerName(ctx) |
| 174 | require.NoError(t, err) |
| 175 | |
| 176 | // Build v2 with the same tag. The local tag now points to a newer image |
| 177 | // than what the running container uses. |
| 178 | buildAndPushImage(t, ctx, imageTag, "v2") |
| 179 | |
| 180 | changed, err := app.Update(ctx, nil) |
| 181 | require.NoError(t, err) |
| 182 | assert.True(t, changed, "Update should detect the newer local image") |
| 183 | |
| 184 | secondContainer, err := app.ContainerName(ctx) |
| 185 | require.NoError(t, err) |
| 186 | assert.NotEqual(t, firstContainer, secondContainer, "container should change after update") |
| 187 | } |
| 188 | |
| 189 | func TestLargeLabelData(t *testing.T) { |
| 190 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) |
nothing calls this directly
no test coverage detected
searching dependent graphs…