-
Notifications
You must be signed in to change notification settings - Fork 484
Closed
Description
Describe the bug
After adding an extra condition (and (eq .name "argocd-applicationset-controller") (eq .port 7000))
when running goss -g test.yaml --vars vars.yaml validate
I get this error:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x77b9e0]
How To Reproduce
vars.yaml
tcp_services:
- name: argo-rollouts-dashboard
namespace: argo-rollouts
port: 3100
- name: argo-rollouts-metrics
namespace: argo-rollouts
port: 8090
- name: argocd-applicationset-controller
namespace: argocd
port: 7000
- name: argocd-applicationset-controller
namespace: argocd
port: 8080
test.yaml
command:
# Ensure TCP services are not reachable by any pod, except Traefik and some other core services
{{ range index .Vars "tcp_services" }}
"kubectl -n demo exec test-network-policy -ti -- /bin/nc -vz -w 1 {{.name}}.{{.namespace}} {{.port}}":
timeout: 30000 # in milliseconds
{{ if or (eq .name "lb-traefik") (eq .name "kube-dns") (eq .name "prometheus-adapter") (and (eq .name "argocd-applicationset-controller") (eq .port 7000)) }}
exit-status: 0
stderr:
- "/{{.name}}.{{.namespace}} .*:{{.port}}.* open/"
{{ else }}
exit-status: 1
stderr:
- "/{{.name}}.{{.namespace}} .*:{{.port}}.* Connection timed out/"
{{ end }}
{{end}}
Expected Behavior
I want to be able to test for 2 conditions at the same time in a complex if statement.
Actual Behavior
I got a segfault error:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x77b9e0]
goroutine 65 [running]:
github.com/goss-org/goss/system.(*DefHTTP).Status(0xc0004ee0d0)
/home/travis/gopath/src/github.com/goss-org/goss/system/http.go:184 +0x40
github.com/goss-org/goss/resource.ValidateValue({0xc2d958, 0xc0005ca8c0}, {0xb29627, 0x6}, {0xa4aa80, 0x1018980}, {0xa51580?, 0xc0002820a8?}, _)
/home/travis/gopath/src/github.com/goss-org/goss/resource/validate.go:135 +0x369
github.com/goss-org/goss/resource.(*HTTP).Validate(0xc0005ca8c0, 0x0?)
/home/travis/gopath/src/github.com/goss-org/goss/resource/http.go:77 +0x305
github.com/goss-org/goss.validate.func2()
/home/travis/gopath/src/github.com/goss-org/goss/validate.go:171 +0x91
created by github.com/goss-org/goss.validate
/home/travis/gopath/src/github.com/goss-org/goss/validate.go:168 +0x190
Environment:
- Version of goss: v0.3.21
- OS/Distribution version (if applicable)
cat /etc/debian_version
bookworm/sid