MCPcopy
hub / github.com/lima-vm/lima / TestValidateProbes

Function TestValidateProbes

pkg/limayaml/validate_test.go:92–115  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestValidateProbes(t *testing.T) {
93 images := `images: [{"location": "/"}]`
94 validProbe := `probes: [{"script": "#!foo"}]`
95 y, err := Load(t.Context(), []byte(validProbe+"\n"+images), "lima.yaml")
96 assert.NilError(t, err)
97
98 err = Validate(y, false)
99 assert.NilError(t, err)
100
101 invalidProbe := `probes: [{"script": "foo"}]`
102 y, err = Load(t.Context(), []byte(invalidProbe+"\n"+images), "lima.yaml")
103 assert.NilError(t, err)
104
105 err = Validate(y, false)
106 assert.Error(t, err, "field `probe[0].script` must start with a '#!' line")
107
108 invalidProbe = `probes: [{file: {digest: decafbad}}]`
109 y, err = Load(t.Context(), []byte(invalidProbe+"\n"+images), "lima.yaml")
110 assert.NilError(t, err)
111
112 err = Validate(y, false)
113 assert.Error(t, err, "field `probe[0].file.digest` support is not yet implemented\n"+
114 "field `probe[0].script` must start with a '#!' line")
115}
116
117func TestValidateProvisionMode(t *testing.T) {
118 images := `images: [{location: /}]`

Callers

nothing calls this directly

Calls 3

LoadFunction · 0.70
ValidateFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected