From 07c7b8b56b241e98f6a3dc3a1b47070b3a7602a9 Mon Sep 17 00:00:00 2001 From: James Liu Date: Thu, 14 Dec 2023 11:48:00 +1100 Subject: backup: Stop sending invalid requests Modifies the Restore CLI tests so we stop sending an invalid restore command as the final JSON object into stdin. This is required as a subsequent commit will move the repository removal logic to execute after the Pipeline completes successfully. If the tests purposely cause the pipeline to fail, the restore logic will never execute. Coverage of the Pipeline's error messaging is covered separately in the Pipeline's unit tests. --- internal/cli/gitalybackup/restore_test.go | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/internal/cli/gitalybackup/restore_test.go b/internal/cli/gitalybackup/restore_test.go index 4eae52e4c..6d235525c 100644 --- a/internal/cli/gitalybackup/restore_test.go +++ b/internal/cli/gitalybackup/restore_test.go @@ -75,12 +75,6 @@ Issue: https://gitlab.com/gitlab-org/gitaly/-/issues/5269`) })) } - require.NoError(t, encoder.Encode(map[string]string{ - "address": "invalid", - "token": "invalid", - "relative_path": "invalid", - })) - ctx = testhelper.MergeIncomingMetadata(ctx, testcfg.GitalyServersMetadataFromCfg(t, cfg)) args := []string{ @@ -103,9 +97,7 @@ Issue: https://gitlab.com/gitlab-org/gitaly/-/issues/5269`) require.DirExists(t, existRepoPath) - require.EqualError(t, - cmd.RunContext(ctx, args), - "restore: pipeline: 1 failures encountered:\n - invalid: manager: could not dial source: invalid connection string: \"invalid\"\n") + require.NoError(t, cmd.RunContext(ctx, args)) require.NoDirExists(t, existRepoPath) @@ -179,12 +171,6 @@ Issue: https://gitlab.com/gitlab-org/gitaly/-/issues/5269`) })) } - require.NoError(t, encoder.Encode(map[string]string{ - "address": "invalid", - "token": "invalid", - "relative_path": "invalid", - })) - ctx = testhelper.MergeIncomingMetadata(ctx, testcfg.GitalyServersMetadataFromCfg(t, cfg)) args := []string{ @@ -207,9 +193,7 @@ Issue: https://gitlab.com/gitlab-org/gitaly/-/issues/5269`) require.DirExists(t, existRepoPath) - require.EqualError(t, - cmd.RunContext(ctx, args), - "restore: pipeline: 1 failures encountered:\n - invalid: server-side restore: could not dial source: invalid connection string: \"invalid\"\n") + require.NoError(t, cmd.RunContext(ctx, args)) require.NoDirExists(t, existRepoPath) -- cgit v1.2.3