FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
stackrox/tests/graphql_utils.go at master · stackrox/stackrox · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
stackrox
/
stackrox
Public
Notifications
You must be signed in to change notification settings
Fork
191
Star
1.3k
Code
Issues
54
Pull requests
596
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
stackrox
/
tests
/
graphql_utils.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (29 loc) · 938 Bytes
Breadcrumbs
stackrox
/
tests
/
graphql_utils.go
Copy path
File metadata and controls
36 lines (29 loc) · 938 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//go:build test_e2e || destructive || test_compatibility
package
tests
import
(
"context"
"time"
"github.com/machinebox/graphql"
"github.com/stackrox/rox/pkg/sync"
"github.com/stackrox/rox/pkg/testutils"
"github.com/stackrox/rox/pkg/testutils/centralgrpc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
var
(
graphQLOnce
sync.
Once
graphqlClient
*
graphql.
Client
)
func
makeGraphQLRequest
(
t
testutils.
T
,
query
string
,
vars
map
[
string
]
interface
{},
resp
interface
{},
timeout
time.
Duration
) {
graphQLOnce
.
Do
(
func
() {
graphqlClient
=
graphql
.
NewClient
(
"/api/graphql"
,
graphql
.
WithHTTPClient
(
centralgrpc
.
HTTPClientForCentral
(
t
)))
require
.
NotNil
(
t
,
graphqlClient
)
})
req
:=
graphql
.
NewRequest
(
query
)
for
key
,
val
:=
range
vars
{
req
.
Var
(
key
,
val
)
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
timeout
)
defer
cancel
()
assert
.
NoError
(
t
,
graphqlClient
.
Run
(
ctx
,
req
,
resp
))
}
Back
|
FazBrowse Home
|
New Git URL