Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling in tbot start #11756

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address review feedback
  • Loading branch information
timothyb89 committed Apr 13, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit d9ac50e30fe5d9e4b7aebd81e9125b336856515f
2 changes: 1 addition & 1 deletion tool/tbot/botfs/botfs.go
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ const (

// OpenMode is the mode with which files should be opened for reading and
// writing.
OpenMode os.FileMode = os.O_CREATE | os.O_RDWR
OpenMode int = os.O_CREATE | os.O_RDWR
timothyb89 marked this conversation as resolved.
Show resolved Hide resolved
)

// ACLOptions contains parameters needed to configure ACLs
13 changes: 6 additions & 7 deletions tool/tbot/botfs/botfs_test.go
Original file line number Diff line number Diff line change
@@ -34,24 +34,23 @@ func TestReadWrite(t *testing.T) {

expectedData := []byte{1, 2, 3, 4}


for _, mode := range []SymlinksMode{SymlinksInsecure, SymlinksTrySecure, SymlinksSecure}, {
for _, mode := range []SymlinksMode{SymlinksInsecure, SymlinksTrySecure, SymlinksSecure} {
if mode == SymlinksSecure && !secureWriteExpected {
t.Logf("skipping secure read/write test due to lack of platform support")
continue
}

path := filepath.Join(dir, string(test.mode))
path := filepath.Join(dir, string(mode))

err := Create(path, false, test.mode)
err := Create(path, false, mode)
require.NoError(t, err)

err = Write(path, expectedData, test.mode)
err = Write(path, expectedData, mode)
require.NoError(t, err)

data, err := Read(path, test.mode)
data, err := Read(path, mode)
require.NoError(t, err)

require.Zero(t, bytes.Compare(data, expectedData), "read bytes must be equal to those written")
require.Equal(t, 0, bytes.Compare(data, expectedData), "read bytes must be equal to those written")
}
}