From 5bb9d0d996bf9ad3552ee3ebc27b6292f1e881ec Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 11 Apr 2025 22:14:27 +0200 Subject: [PATCH] backup: test subdirectories in stdin filenames work --- cmd/restic/cmd_backup_integration_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/restic/cmd_backup_integration_test.go b/cmd/restic/cmd_backup_integration_test.go index 06d71e345..0002b207f 100644 --- a/cmd/restic/cmd_backup_integration_test.go +++ b/cmd/restic/cmd_backup_integration_test.go @@ -632,12 +632,15 @@ func TestStdinFromCommand(t *testing.T) { testSetupBackupData(t, env) opts := BackupOptions{ - StdinCommand: true, - StdinFilename: "stdin", + StdinCommand: true, + // test that subdirectories are handled correctly + StdinFilename: "stdin/subdir/file", } testRunBackup(t, filepath.Dir(env.testdata), []string{"python", "-c", "import sys; print('something'); sys.exit(0)"}, opts, env.gopts) - testListSnapshots(t, env.gopts, 1) + snapshots := testListSnapshots(t, env.gopts, 1) + files := testRunLs(t, env.gopts, snapshots[0].String()) + rtest.Assert(t, includes(files, "/stdin/subdir/file"), "file %q missing from snapshot, got %v", "stdin/subdir/file", files) testRunCheck(t, env.gopts) }