Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
  • Loading branch information
Two-Hearts committed Jan 9, 2025
1 parent b858af6 commit ac5f3b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmd/notation/blob/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package blob provides the implementation of the `notation blob` command
package blob

import "github.com/spf13/cobra"
Expand Down
14 changes: 11 additions & 3 deletions test/e2e/suite/command/blob/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,20 @@ var _ = Describe("notation blob sign", func() {

It("with no permission to read the blob file", func() {
HostWithBlob(BaseOptions(), func(notation *utils.ExecOpts, blobPath string, vhost *utils.VirtualHost) {
if err := os.Chmod(blobPath, 0000); err != nil {
blobDir := filepath.Dir(blobPath)
noPermissionBlobPath := filepath.Join(blobDir, "noPermissionBlob")
newBlobFile, err := os.Create(noPermissionBlobPath)
if err != nil {
Fail(err.Error())
}
defer newBlobFile.Close()

if err := os.Chmod(noPermissionBlobPath, 0000); err != nil {
Fail(err.Error())
}
defer os.Chmod(blobPath, 0700)
defer os.Chmod(noPermissionBlobPath, 0700)

notation.ExpectFailure().Exec("blob", "sign", blobPath).
notation.ExpectFailure().Exec("blob", "sign", noPermissionBlobPath).
MatchErrKeyWords("permission denied")
})
})
Expand Down

0 comments on commit ac5f3b7

Please sign in to comment.