Skip to content

Commit

Permalink
add slow resource
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-rock committed Dec 20, 2023
1 parent 931a38c commit 32a889d
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 134 deletions.
6 changes: 6 additions & 0 deletions providers/core/resources/core.lr
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,10 @@ cpe @defaults("uri") {
targetHw() string
// Other of the CPE
other() string
}

slow {
field() string
field2() string
list() []string
}
94 changes: 94 additions & 0 deletions providers/core/resources/core.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions providers/core/resources/core.lr.manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,12 @@ resources:
url: {}
uuid: {}
min_mondoo_version: 5.15.0
slow:
fields:
field: {}
field2: {}
list: {}
min_mondoo_version: latest
socket:
fields:
address: {}
Expand Down
2 changes: 1 addition & 1 deletion providers/core/resources/core.resources.json

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions providers/core/resources/slow.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package resources

import (
"go.mondoo.com/cnquery/v9/providers-sdk/v1/util/convert"
"time"
)

func (u *mqlSlow) id() (string, error) {
return "slow", nil
}

func (u *mqlSlow) field() (string, error) {
time.Sleep(30 * time.Second)
return "field", nil
}

func (u *mqlSlow) field2() (string, error) {
time.Sleep(60 * time.Second)
return "field", nil
}

func (u *mqlSlow) list() ([]interface{}, error) {
time.Sleep(240 * time.Second)
return convert.SliceAnyToInterface([]string{"a", "b", "b", "d"}), nil
}
Loading

0 comments on commit 32a889d

Please sign in to comment.