Skip to content

Commit

Permalink
updated per code review
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 Jul 30, 2024
1 parent d91177f commit a67038e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions cmd/notation/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ type certificateOutput struct {
}

type timestampOutput struct {
Timestamp string `json:"timestamp,omitempty"`
TimestampCertificates []certificateOutput `json:"timestampCertificates,omitempty"`
Error string `json:"error,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
Certificates []certificateOutput `json:"certificates,omitempty"`
Error string `json:"error,omitempty"`
}

func inspectCommand(opts *inspectOpts) *cobra.Command {
Expand Down Expand Up @@ -316,13 +316,13 @@ func printOutput(outputFormat string, ref string, output inspectOutput) error {
case string:
unsignedAttributesNode.AddPair(k, value)
case timestampOutput:
timestampNode := unsignedAttributesNode.Add("timestampSignature")
timestampNode := unsignedAttributesNode.Add("timestamp signature")
if value.Error != "" {
timestampNode.AddPair("error", value.Error)
break

Check warning on line 322 in cmd/notation/inspect.go

View check run for this annotation

Codecov / codecov/patch

cmd/notation/inspect.go#L321-L322

Added lines #L321 - L322 were not covered by tests
}
timestampNode.AddPair("timestamp", value.Timestamp)
addCertificatesToTree(timestampNode, "timestampCertificates", value.TimestampCertificates)
addCertificatesToTree(timestampNode, "certificates", value.Certificates)
}
}

Expand Down Expand Up @@ -386,7 +386,7 @@ func parseTimestamp(outputFormat string, signerInfo signature.SignerInfo) timest
formatTimestamp = timestamp.Format(time.ANSIC)
}
return timestampOutput{
Timestamp: formatTimestamp,
TimestampCertificates: certificates,
Timestamp: formatTimestamp,
Certificates: certificates,
}
}
4 changes: 2 additions & 2 deletions test/e2e/suite/command/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ var (
"│ └── (empty)",
"├── unsigned attributes",
"signingAgent: Notation/",
"timestampSignature",
"timestamp signature",
"timestamp:",
"timestampCertificates",
"certificates",
"SHA256 fingerprint:",
"├── certificates",
"│ └── SHA256 fingerprint:",
Expand Down

0 comments on commit a67038e

Please sign in to comment.