-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ mqueries.RefreshChecksums + migrate tests #59
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package policy | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestMquery_Whitespaces(t *testing.T) { | ||
mq := Mquery{ | ||
Query: " mondoo { version \n} \t\n ", | ||
} | ||
|
||
mqexpect := Mquery{ | ||
Query: "mondoo { version \n}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with this... |
||
} | ||
|
||
bundle, err := mq.RefreshChecksumAndType(nil) | ||
assert.NoError(t, err) | ||
assert.NotNil(t, bundle) | ||
|
||
bundle, err = mqexpect.RefreshChecksumAndType(nil) | ||
assert.NoError(t, err) | ||
assert.NotNil(t, bundle) | ||
|
||
assert.Equal(t, mqexpect.CodeId, mq.CodeId) | ||
} | ||
|
||
func TestMquery_CodeIDs(t *testing.T) { | ||
mqAssetFilter := Mquery{ | ||
Query: "mondoo { version \n}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with this... |
||
} | ||
|
||
mqReg := Mquery{ | ||
Query: "mondoo { version \n}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with this... |
||
} | ||
|
||
_, err := mqAssetFilter.RefreshAsAssetFilter("//some.mrn") | ||
assert.NoError(t, err) | ||
|
||
_, err = mqReg.RefreshChecksumAndType(nil) | ||
assert.NoError(t, err) | ||
|
||
assert.Equal(t, mqReg.CodeId, mqAssetFilter.CodeId) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arlimus should this be
mondoo
orcnspec
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100% that we need to migrate the
mondoo
resource. I think the better name ismql
since the resource is available in cnquery and cnspec.Since this PR just adds tests, I propose we do this change in a followup PR