Skip to content

Commit

Permalink
request-server: add test cases for links to non-existent files
Browse files Browse the repository at this point in the history
  • Loading branch information
georgmu committed Sep 29, 2022
1 parent 2aed0cb commit 2b5a4f9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions request-server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,9 @@ func TestRequestSymlink(t *testing.T) {
err = p.cli.Symlink("/bar", "/baz")
require.NoError(t, err)

err = p.cli.Symlink("non-existent-file", "/link-to-non-existent-file")
require.NoError(t, err)

err = p.cli.Mkdir("/subdir")
require.NoError(t, err)
_, err = putTestFile(p.cli, "/subdir/f1", "f1_content")
Expand All @@ -601,6 +604,13 @@ func TestRequestSymlink(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, []byte("hello"), content)

fi, err = r.lfetch("/link-to-non-existent-file")
require.NoError(t, err)
assert.True(t, fi.Mode()&os.ModeSymlink == os.ModeSymlink)

_, err = r.fetch("/link-to-non-existent-file")
require.True(t, os.IsNotExist(err))

content, err = getTestFile(p.cli, "/subdir/linked_f1")
require.NoError(t, err)
assert.Equal(t, []byte("f1_content"), content)
Expand Down

0 comments on commit 2b5a4f9

Please sign in to comment.