@@ -159,6 +159,12 @@ describe("archive", () => {
159159
160160 const { id } = await installArchive ( state ) ;
161161
162+ const createTestdata = await bashRun (
163+ id ,
164+ `mkdir ~/gzip; touch ~/gzip/defaults.txt` ,
165+ ) ;
166+ ensureRunOk ( "create testdata" , createTestdata ) ;
167+
162168 const run = await bashRun ( id , `${ BIN_DIR } /coder-archive-create` ) ;
163169 ensureRunOk ( "archive-create default run" , run ) ;
164170
@@ -172,35 +178,39 @@ describe("archive", () => {
172178
173179 const list = await listTar ( id , "/tmp/coder-archive.tar.gz" ) ;
174180 ensureRunOk ( "list default archive" , list ) ;
175-
176- // We don't assert specific entries to avoid environment coupling.
177- expect ( list . stdout . length ) . toBeGreaterThan ( 0 ) ;
181+ expect ( list . stdout ) . toContain ( "gzip/defaults.txt" ) ;
178182 } , 20000 ) ;
179183
180184 it ( "creates a gzip archive with explicit -f and includes extra CLI paths" , async ( ) => {
181185 const state = await runTerraformApply ( import . meta. dir , {
182186 agent_id : "agent-123" ,
183187 // Provide a simple default path so we can assert contents.
184- paths : `["/etc/hostname "]` ,
188+ paths : `["~/gzip "]` ,
185189 compression : "gzip" ,
186190 } ) ;
187191
188192 const { id } = await installArchive ( state ) ;
189193
194+ const createTestdata = await bashRun (
195+ id ,
196+ `mkdir ~/gzip; touch ~/gzip/test.txt; touch ~/gziptest.txt` ,
197+ ) ;
198+ ensureRunOk ( "create testdata" , createTestdata ) ;
199+
190200 const out = "/tmp/backup/test-archive.tar.gz" ;
191201 const run = await bashRun (
192202 id ,
193- `${ BIN_DIR } /coder-archive-create -f ${ out } /etc/hosts ` ,
203+ `${ BIN_DIR } /coder-archive-create -f ${ out } ~/gziptest.txt ` ,
194204 ) ;
195205 ensureRunOk ( "archive-create gzip explicit -f" , run ) ;
196206
197207 expect ( run . stdout . trim ( ) ) . toEqual ( out ) ;
198208 expect ( await fileExists ( id , out ) ) . toBe ( true ) ;
199209
200- const tarList = await sh ( id , `tar -tzf ${ out } ` ) ;
201- ensureRunOk ( "tar -tzf contents (gzip)" , tarList ) ;
202- expect ( tarList . stdout ) . toContain ( "etc/hosts " ) ;
203- expect ( tarList . stdout ) . toContain ( "etc/hostname " ) ;
210+ const list = await sh ( id , `tar -tzf ${ out } ` ) ;
211+ ensureRunOk ( "tar -tzf contents (gzip)" , list ) ;
212+ expect ( list . stdout ) . toContain ( "gzip/test.txt " ) ;
213+ expect ( list . stdout ) . toContain ( "gziptest.txt " ) ;
204214 } , 20000 ) ;
205215
206216 it ( "creates a zstd-compressed archive when requested via CLI override" , async ( ) => {
0 commit comments