add more args for http container test

Signed-off-by: jffarge <slumbering.pierrot@gmail.com>
This commit is contained in:
jffarge
2021-10-22 16:13:55 +02:00
committed by guillaume
parent b94b8c0c70
commit 04781f4e07
2 changed files with 19 additions and 21 deletions

View File

@@ -1,7 +1,8 @@
package http
import (
"encoding/json"
// "encoding/json"
// "strconv"
"alpha.dagger.io/alpine"
"alpha.dagger.io/os"
@@ -12,31 +13,27 @@ TestRequest: {
url: "https://api.github.com/"
request: header: {
Accept: "application/json"
Test: ["A", "B"]
}
}
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
}
command: #"""
test "$STATUS" = 200
test "$(cat /content.json | jq -r .current_user_url)" = "https://api.github.com/user"
"""#
}
testJSON: os.#Container & {
env: STATUS: "\(req.response.statusCode)"
env: CONTENT: json.Unmarshal(req.response.body).current_user_url
command: """
test "$STATUS" = 200
test "$CONTENT" = "https://api.github.com/user"
"""
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"
"""#