(t *testing.T)
| 561 | } |
| 562 | |
| 563 | func TestRestoreWithPostRestoreHook(t *testing.T) { |
| 564 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) |
| 565 | defer cancel() |
| 566 | |
| 567 | registryURL := startLocalRegistry(t, ctx) |
| 568 | hookImage := buildHookImage(t, ctx, registryURL, "restore-hook-success", "#!/bin/sh\ncp /storage/hook-input /storage/hook-output") |
| 569 | |
| 570 | backup := buildTestBackup(t, hookImage) |
| 571 | |
| 572 | ns, err := docker.NewNamespace("once-restore-hook-test") |
| 573 | require.NoError(t, err) |
| 574 | defer ns.Teardown(ctx, true) |
| 575 | |
| 576 | require.NoError(t, ns.EnsureNetwork(ctx)) |
| 577 | require.NoError(t, ns.Proxy().Boot(ctx, getProxyPorts(t))) |
| 578 | |
| 579 | restoredApp, err := ns.Restore(ctx, bytes.NewReader(backup)) |
| 580 | require.NoError(t, err) |
| 581 | assert.NotEmpty(t, restoredApp.Settings.Name) |
| 582 | |
| 583 | containerName, err := restoredApp.ContainerName(ctx) |
| 584 | require.NoError(t, err) |
| 585 | execInContainer(t, ctx, containerName, []string{"test", "-f", "/storage/hook-output"}) |
| 586 | } |
| 587 | |
| 588 | func TestRestoreFailsWithFailedPostRestoreHook(t *testing.T) { |
| 589 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) |
nothing calls this directly
no test coverage detected
searching dependent graphs…