Permalink
Browse files

[bugfix] Add Matching resource to NewGossConfig() (#280)

* Fixes #278

* Add integration tests for matching resource
  • Loading branch information...
OmarDarwish authored and aelsabbahy committed Sep 12, 2017
1 parent 013c595 commit 5e1f54668bbcfb3ed1e047b47950e091788500ea
Showing with 27 additions and 3 deletions.
  1. +5 −0 goss_config.go
  2. +19 −0 integration-tests/goss/goss-shared.yaml
  3. +2 −2 integration-tests/test.sh
  4. +1 −1 resource/matching.go
View
@@ -42,6 +42,7 @@ func NewGossConfig() *GossConfig {
Mounts: make(resource.MountMap),
Interfaces: make(resource.InterfaceMap),
HTTPs: make(resource.HTTPMap),
Matchings: make(resource.MatchingMap),
}
}
@@ -157,5 +158,9 @@ func mergeGoss(g1, g2 GossConfig) GossConfig {
g1.HTTPs[k] = v
}
for k, v := range g2.Matchings {
g1.Matchings[k] = v
}
return g1
}
@@ -157,3 +157,22 @@ http:
allow-insecure: false
timeout: 5000
body: []
matching:
has_substr:
content: some string
matches:
match-regexp: some str
has_2:
content:
- 2
matches:
contain-element: 2
has_foo_bar_and_baz:
content:
foo: bar
baz: bing
matches:
and:
- have-key-with-value:
foo: bar
- have-key: baz
@@ -44,9 +44,9 @@ out=$(docker_exec "/goss/$os/goss-linux-$arch" --vars "/goss/vars.yaml" -g "/gos
echo "$out"
if [[ $os == "arch" ]]; then
egrep -q 'Count: 65, Failed: 0' <<<"$out"
egrep -q 'Count: 68, Failed: 0' <<<"$out"
else
egrep -q 'Count: 79, Failed: 0' <<<"$out"
egrep -q 'Count: 82, Failed: 0' <<<"$out"
fi
if [[ ! $os == "arch" ]]; then
View
@@ -27,7 +27,7 @@ func (a *Matching) SetID(id string) { a.Id = id }
func (r *Matching) GetTitle() string { return r.Title }
func (r *Matching) GetMeta() meta { return r.Meta }
func (a *Matching) Validate(sys system.System) []TestResult {
func (a *Matching) Validate(sys *system.System) []TestResult {
skip := false
// ValidateValue expects a function

0 comments on commit 5e1f546

Please sign in to comment.