Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielCosme committed Aug 2, 2024
1 parent d4e546e commit d16f252
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions internal/workflow/activities/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,46 @@ func TestBundleActivity(t *testing.T) {
),
)
})

t.Run("Remove hidden files when BatchDir is a subfolder of the TransferDir", func(t *testing.T) {
activity := NewBundleActivity()
ts := &temporalsdk_testsuite.WorkflowTestSuite{}
env := ts.NewTestActivityEnvironment()
env.RegisterActivity(activity.Execute)

transferDir := fs.NewDir(t, "enduro",
fs.WithDir("batch-folder",
fs.WithDir(
"transfer",
fs.WithFile("foobar.txt", "Hello world!\n"),
fs.WithFile(".hidden", ""),
),
),
)

fut, err := env.ExecuteActivity(activity.Execute, &BundleActivityParams{
ExcludeHiddenFiles: true,
IsDir: true,
TransferDir: transferDir.Path(),
BatchDir: transferDir.Join("batch-folder"),
Key: "transfer",
})
assert.NilError(t, err)

res := BundleActivityResult{}
assert.NilError(t, fut.Get(&res))
assert.DeepEqual(t, res, res)
assert.Assert(t,
fs.Equal(
transferDir.Join("batch-folder", "transfer"),
fs.Expected(t,
// .hidden is not expected because ExcludeHiddenFiles is enabled.
fs.WithFile("foobar.txt", "Hello world!\n"),
fs.MatchAnyFileMode,
),
),
)
})
}

func TestUnbag(t *testing.T) {
Expand Down

0 comments on commit d16f252

Please sign in to comment.