bats: Fix spec validation test#900
Conversation
|
https://github.com/opencontainers/runtime-spec/pull/481/files broke spec validation. This PR should make the test more reliable. |
|
@crosbymichael @LK4D4 PTAL. Tests are broken right now without fixing this. |
tests/integration/spec.bats
Outdated
| run git reset --hard $SPEC_COMMIT | ||
| [ "$status" -eq 0 ] | ||
|
|
||
| cd "$HELLO_BUNDLE" |
There was a problem hiding this comment.
Instead of cding in and back, you can use something like run git -C src/runtime-spec reset --hard "${SPEC_COMMIT}".
fb2c7a9 to
9b6469d
Compare
| [ "$status" -eq 0 ] | ||
|
|
||
| SPEC_COMMIT=$(grep runtime-spec ${TESTDIR}/../../Godeps/Godeps.json -A 4 | grep Rev | cut -d":" -f 2 | tr -d ' "') | ||
| run git -C src/runtime-spec reset --hard "${SPEC_COMMIT}" |
There was a problem hiding this comment.
I'm not familiar with bats, but I think you want to check the exit status of the Git command with [ "$status -eq 0]. The existence of schema.json isn't sufficient to tell if the reset succeeded.
Use the commit that we have in Godeps.json rather than relying on runtime-spec HEAD Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
|
I'm not familiar with bats, and I haven't checked the Godeps grep.
But other than that, 10d7cfb looks good to me.
|
| run git clone https://github.com/opencontainers/runtime-spec.git src/runtime-spec | ||
| [ "$status" -eq 0 ] | ||
|
|
||
| SPEC_COMMIT=$(grep runtime-spec ${TESTDIR}/../../Godeps/Godeps.json -A 4 | grep Rev | cut -d":" -f 2 | tr -d ' "') |
There was a problem hiding this comment.
I'm guessing we can't get these files from Godep/* because we clean them? Whatever, we can fix this is in a followup PR. I don't like the brittle -A 4 though.
There was a problem hiding this comment.
Yeah, those files aren't in Godeps. We can clean up -A 4 with either python or jq. I'll create a follow up. Wanted to fix the build fast.
…ation *: Add "Initiative" to OCI Runtime Specification and expand OCI
Use the commit that we have in Godeps.json rather than relying on
runtime-spec HEAD
Signed-off-by: Mrunal Patel mrunalp@gmail.com