6825309f31
Signed-off-by: jffarge <slumbering.pierrot@gmail.com>
56 lines
1.1 KiB
CUE
56 lines
1.1 KiB
CUE
package graphql
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"alpha.dagger.io/alpine"
|
|
"alpha.dagger.io/dagger"
|
|
"alpha.dagger.io/docker"
|
|
"alpha.dagger.io/os"
|
|
"alpha.dagger.io/http"
|
|
)
|
|
|
|
TestDockersocket: dagger.#Stream & dagger.#Input
|
|
|
|
TestQuery: {
|
|
|
|
run: docker.#Run & {
|
|
name: "graphql-faker"
|
|
ref: "apisguru/graphql-faker"
|
|
socket: TestDockersocket
|
|
ports: ["8080:9002"]
|
|
}
|
|
|
|
// Waits for TestRun to finish initializing
|
|
Testhealth: http.#Wait & {
|
|
url: "http://localhost:8080/graphql?query={%7BallCompanies%20%7B%0A%20%20%20%20id%0A%20%20%7D%0A%7D}"
|
|
}
|
|
|
|
queryWithoutToken: #Query & {
|
|
url: Testhealth.url
|
|
query: #"""
|
|
{
|
|
company(id: "NjExNjAwMjE5Nw==") {
|
|
id
|
|
}
|
|
}
|
|
"""#
|
|
}
|
|
|
|
testRaw: os.#Container & {
|
|
image: alpine.#Image & {
|
|
package: jq: "~=1.6"
|
|
}
|
|
env: STATUS: "\(queryWithoutToken.post.response.statusCode)"
|
|
shell: args: ["--noprofile", "--norc", "-eo", "pipefail", "-c"]
|
|
files: "/content.json": {
|
|
content: json.Marshal(queryWithoutToken.data)
|
|
mode: 0o500
|
|
}
|
|
command: #"""
|
|
test "$STATUS" = "200"
|
|
test "$(cat /content.json | jq '.allCompanies | length')" -gt 1
|
|
"""#
|
|
}
|
|
}
|