Skip to content

Commit

Permalink
fix: e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: Fritz Duchardt <[email protected]>
  • Loading branch information
fritzduchardt committed Nov 10, 2023
1 parent d7f93e9 commit a025bd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/vendir/directory/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (d *Directory) Sync(syncOpts SyncOpts) (ctlconf.LockDirectory, error) {
// copy previously fetched contents to staging dir
err = dircopy.Copy(filepath.Join(d.opts.Path, contents.Path), stagingDstPath)
if err != nil {
return lockConfig, fmt.Errorf("Copying existing content to staging '%s': %s", d.opts.Path, err)
return lockConfig, fmt.Errorf("Lazy content missing. Run sync with --lazy=false to fix. '%s': %s", d.opts.Path, err)
}
continue
}
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/example_lazy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ func TestExampleLazy(t *testing.T) {
require.NoError(t, err)
require.NotEmpty(t, lockConf.Directories[0].Contents[0].ConfigDigest, "Expected Config Digest in Lock File")

// remove some directory
err = os.RemoveAll(path + "/vendor/dir")
// remove file from synced dir
err = os.Remove(path + "/vendor/dir/some-file.txt")
require.NoError(t, err)

// resync lazily, should not sync. Removed dir has not been reinstated
_, err = vendir.RunWithOpts([]string{"sync", "-f=vendir-lazy.yml"}, RunOpts{Dir: path, Env: osEnv})
require.NoError(t, err)
require.NoDirExists(t, path+"/vendor/dir")
require.NoFileExists(t, path+"/vendor/dir/some-file.txt")

// resync with lazy override, should not affect config digest
_, err = vendir.RunWithOpts([]string{"sync", "--lazy=false", "-f=vendir-lazy.yml"}, RunOpts{Dir: path, Env: osEnv})
require.NoError(t, err)
require.DirExists(t, path+"/vendor/dir")
require.FileExists(t, path+"/vendor/dir/some-file.txt")

// content digest is kept during lazy sync override
lockConf, err = ctlconf.NewLockConfigFromFile(path + "/vendir.lock.yml")
Expand Down

0 comments on commit a025bd8

Please sign in to comment.