Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zheng <[email protected]>
  • Loading branch information
Two-Hearts committed Jun 27, 2024
1 parent 1a8fe7b commit 1526dbe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/e2e/suite/command/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ var _ = Describe("notation sign", func() {
})
})

It("with empty tsa server", func() {
Host(BaseOptions(), func(notation *utils.ExecOpts, artifact *Artifact, vhost *utils.VirtualHost) {
notation.ExpectFailure().Exec("sign", "--tsa-url", "", "--tsa-root-cert", filepath.Join(NotationE2EConfigPath, "timestamp", "globalsignTSARoot.cer"), artifact.ReferenceWithDigest()).
MatchErrKeyWords("Error: tsa-url is set with empty value")
})
})

It("with invalid tsa server", func() {
Host(BaseOptions(), func(notation *utils.ExecOpts, artifact *Artifact, vhost *utils.VirtualHost) {
notation.ExpectFailure().Exec("sign", "--tsa-url", "http://invalid.com", "--tsa-root-cert", filepath.Join(NotationE2EConfigPath, "timestamp", "globalsignTSARoot.cer"), artifact.ReferenceWithDigest()).
Expand All @@ -274,6 +281,13 @@ var _ = Describe("notation sign", func() {
})
})

It("with invalid tsa root certificate", func() {
Host(BaseOptions(), func(notation *utils.ExecOpts, artifact *Artifact, vhost *utils.VirtualHost) {
notation.ExpectFailure().Exec("sign", "--tsa-url", "http://timestamp.digicert.com", "--tsa-root-cert", filepath.Join(NotationE2EConfigPath, "timestamp", "invalid.crt"), artifact.ReferenceWithDigest()).
MatchErrKeyWords("Error: timestamp: Post \"http://invalid.com\"")
})
})

It("with empty tsa root certificate path", func() {
Host(BaseOptions(), func(notation *utils.ExecOpts, artifact *Artifact, vhost *utils.VirtualHost) {
notation.ExpectFailure().Exec("sign", "--tsa-url", "http://timestamp.digicert.com", "--tsa-root-cert", "", artifact.ReferenceWithDigest()).
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/testdata/config/timestamp/invalid.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----

0 comments on commit 1526dbe

Please sign in to comment.