Skip to content

Commit 330340d

Browse files
committed
fix: add nosec to tests
Signed-off-by: Artur Shad Nik <[email protected]>
1 parent 5e4a71d commit 330340d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/utils/utils.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func Run(cmd *exec.Cmd) (string, error) {
6363
// InstallPrometheusOperator installs the prometheus Operator to be used to export the enabled metrics.
6464
func InstallPrometheusOperator() error {
6565
url := fmt.Sprintf(prometheusOperatorURL, prometheusOperatorVersion)
66+
// #nosec G204
6667
cmd := exec.Command("kubectl", "create", "-f", url)
6768
_, err := Run(cmd)
6869
return err
@@ -71,6 +72,7 @@ func InstallPrometheusOperator() error {
7172
// UninstallPrometheusOperator uninstalls the prometheus
7273
func UninstallPrometheusOperator() {
7374
url := fmt.Sprintf(prometheusOperatorURL, prometheusOperatorVersion)
75+
// #nosec G204
7476
cmd := exec.Command("kubectl", "delete", "-f", url)
7577
if _, err := Run(cmd); err != nil {
7678
warnError(err)
@@ -107,6 +109,7 @@ func IsPrometheusCRDsInstalled() bool {
107109
// UninstallCertManager uninstalls the cert manager
108110
func UninstallCertManager() {
109111
url := fmt.Sprintf(certmanagerURLTmpl, certmanagerVersion)
112+
// #nosec G204
110113
cmd := exec.Command("kubectl", "delete", "-f", url)
111114
if _, err := Run(cmd); err != nil {
112115
warnError(err)
@@ -116,6 +119,7 @@ func UninstallCertManager() {
116119
// InstallCertManager installs the cert manager bundle.
117120
func InstallCertManager() error {
118121
url := fmt.Sprintf(certmanagerURLTmpl, certmanagerVersion)
122+
// #nosec G204
119123
cmd := exec.Command("kubectl", "apply", "-f", url)
120124
if _, err := Run(cmd); err != nil {
121125
return err
@@ -172,6 +176,7 @@ func LoadImageToKindClusterWithName(name string) error {
172176
cluster = v
173177
}
174178
kindOptions := []string{"load", "docker-image", name, "--name", cluster}
179+
// #nosec G204
175180
cmd := exec.Command("kind", kindOptions...)
176181
_, err := Run(cmd)
177182
return err
@@ -206,6 +211,7 @@ func GetProjectDir() (string, error) {
206211
func UncommentCode(filename, target, prefix string) error {
207212
// false positive
208213
// nolint:gosec
214+
// #nosec G304
209215
content, err := os.ReadFile(filename)
210216
if err != nil {
211217
return err
@@ -247,5 +253,6 @@ func UncommentCode(filename, target, prefix string) error {
247253
}
248254
// false positive
249255
// nolint:gosec
256+
// #nosec G306
250257
return os.WriteFile(filename, out.Bytes(), 0644)
251258
}

0 commit comments

Comments
 (0)