This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/stdlib/http/tests/http.cue
jffarge 04781f4e07 add more args for http container test
Signed-off-by: jffarge <slumbering.pierrot@gmail.com>
2021-10-28 17:20:41 +02:00

40 lines
701 B
CUE

package http
import (
// "encoding/json"
// "strconv"
"alpha.dagger.io/alpine"
"alpha.dagger.io/os"
)
TestRequest: {
req: #Get & {
url: "https://api.github.com/"
request: header: {
Accept: "application/json"
}
}
testRaw: os.#Container & {
image: alpine.#Image & {
package: jq: "~=1.6"
package: bash: true
}
env: STATUS: "\(req.response.statusCode)"
files: "/content.json": {
content: req.response.body
mode: 0o500
}
shell: {
args: ["--noprofile", "--norc", "-eo", "pipefail", "-c"]
}
command: #Command
}
}
#Command: #"""
test "$(cat /content.json | jq -r .current_user_url)" = 'https://api.github.com/user'
test "$STATUS" = "200"
"""#