-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathsample.go
49 lines (39 loc) · 1.57 KB
/
sample.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package samples
import (
"fmt"
"github.com/redhat-certification/chart-verifier/pkg/chartverifier/checks"
"github.com/redhat-certification/chart-verifier/pkg/chartverifier/report"
"github.com/redhat-certification/chart-verifier/pkg/chartverifier/reportsummary"
"github.com/redhat-certification/chart-verifier/pkg/chartverifier/verifier"
)
func runVerifier() error {
// Run verify command for a chart, but omit the chart testing check and run checks based on the redhat profile
commandSet := make(map[string]interface{})
commandSet["profile.vendortype"] = "redhat"
verifier, verifierErr := verifier.NewVerifier().
SetValues(verifier.CommandSet, commandSet).
UnEnableChecks([]checks.CheckName{checks.ChartTesting}).
Run("https://github.com/redhat-certification/chart-verifier/blob/main/tests/charts/psql-service/0.1.9/psql-service-0.1.9.tgz?raw=true")
if verifierErr != nil {
return verifierErr
}
// Get and print the report from the verify command
report, reportErr := verifier.GetReport().
GetContent(report.YamlReport)
if reportErr != nil {
return reportErr
}
fmt.Println("report content:\n", report)
// Get and print the report summary of the report, but using the partnet profile.
values := make(map[string]interface{})
values["profile.vendortype"] = "redhat"
reportSummary, summmaryErr := reportsummary.NewReportSummary().
SetReport(verifier.GetReport()).
SetValues(values).
GetContent(reportsummary.AllSummary, reportsummary.JSONReport)
if summmaryErr != nil {
return summmaryErr
}
fmt.Println("report summary content:\n", reportSummary)
return nil
}