Skip to content

Commit

Permalink
Update content parser tests, improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
natiiix committed Apr 16, 2020
1 parent 03d04f4 commit ac05e38
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
7 changes: 7 additions & 0 deletions content/content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,10 @@ func TestContentParseBadMetadataYAML(t *testing.T) {
_, err := content.ParseRuleContentDir("../tests/content/bad_metadata/")
assert.EqualError(t, err, errYAMLBadToken)
}

// TestContentParseBadMetadataYAML tests handling bad/incorrect metadata.yaml file
func TestContentParseNoExternal(t *testing.T) {
noExternalPath := "../tests/content/no_external"
_, err := content.ParseRuleContentDir(noExternalPath)
assert.EqualError(t, err, fmt.Sprintf("open %s/external: no such file or directory", noExternalPath))
}
13 changes: 13 additions & 0 deletions tests/content/missing/external/rules/rule2/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2020 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
24 changes: 24 additions & 0 deletions tests/content/no_external/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2020 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

impact:
One: 1
Two: 2
Three: 3
Four: 4
Five: 5
Six: 6
Seven: 7
Eight: 8
Nine: 9

0 comments on commit ac05e38

Please sign in to comment.