chore: import upstream snapshot with attribution
SDK Tests / changes (push) Successful in 2m29s
Real E2E Tests / changes (push) Successful in 2m29s
Deploy Docs Pages / build (push) Has been cancelled
Deploy Docs Pages / deploy (push) Has been cancelled
Real E2E Tests / JavaScript E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Python E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Java E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / C# E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Go E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Real E2E CI (push) Has been cancelled
SDK Tests / SDK CI (push) Has been cancelled
SDK Tests / CLI Tests (push) Has been cancelled
SDK Tests / Python SDK Quality (code-interpreter) (push) Has been cancelled
SDK Tests / Python SDK Quality (sandbox) (push) Has been cancelled
SDK Tests / Python SDK Tests (code-interpreter) (push) Has been cancelled
SDK Tests / JavaScript SDK Quality And Tests (code-interpreter) (push) Has been cancelled
SDK Tests / JavaScript SDK Quality And Tests (sandbox) (push) Has been cancelled
SDK Tests / Python SDK Tests (sandbox) (push) Has been cancelled
SDK Tests / CLI Quality (push) Has been cancelled
SDK Tests / Kotlin SDK Quality And Tests (sandbox) (push) Has been cancelled
SDK Tests / Kotlin SDK Quality And Tests (code-interpreter) (push) Has been cancelled
SDK Tests / C# SDK Quality And Tests (code-interpreter) (push) Has been cancelled
SDK Tests / C# SDK Quality And Tests (sandbox) (push) Has been cancelled
SDK Tests / Go SDK Quality And Tests (push) Has been cancelled
SDK Tests / changes (push) Successful in 2m29s
Real E2E Tests / changes (push) Successful in 2m29s
Deploy Docs Pages / build (push) Has been cancelled
Deploy Docs Pages / deploy (push) Has been cancelled
Real E2E Tests / JavaScript E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Python E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Java E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / C# E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Go E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Real E2E CI (push) Has been cancelled
SDK Tests / SDK CI (push) Has been cancelled
SDK Tests / CLI Tests (push) Has been cancelled
SDK Tests / Python SDK Quality (code-interpreter) (push) Has been cancelled
SDK Tests / Python SDK Quality (sandbox) (push) Has been cancelled
SDK Tests / Python SDK Tests (code-interpreter) (push) Has been cancelled
SDK Tests / JavaScript SDK Quality And Tests (code-interpreter) (push) Has been cancelled
SDK Tests / JavaScript SDK Quality And Tests (sandbox) (push) Has been cancelled
SDK Tests / Python SDK Tests (sandbox) (push) Has been cancelled
SDK Tests / CLI Quality (push) Has been cancelled
SDK Tests / Kotlin SDK Quality And Tests (sandbox) (push) Has been cancelled
SDK Tests / Kotlin SDK Quality And Tests (code-interpreter) (push) Has been cancelled
SDK Tests / C# SDK Quality And Tests (code-interpreter) (push) Has been cancelled
SDK Tests / C# SDK Quality And Tests (sandbox) (push) Has been cancelled
SDK Tests / Go SDK Quality And Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)
|
||||
script="$repo_root/sandboxes/code-interpreter/scripts/code-interpreter.sh"
|
||||
sandbox=$(mktemp -d)
|
||||
trap 'rm -rf "$sandbox"' EXIT
|
||||
|
||||
write_tslab_stub() {
|
||||
cat >"$sandbox/tslab" <<'STUB'
|
||||
#!/usr/bin/env bash
|
||||
echo "tslab $*" >>"$CALL_LOG"
|
||||
STUB
|
||||
chmod +x "$sandbox/tslab"
|
||||
}
|
||||
|
||||
cat >"$sandbox/npm" <<'STUB'
|
||||
#!/usr/bin/env bash
|
||||
echo "npm $*" >>"$CALL_LOG"
|
||||
if [ "$1 $2 $3" = "install -g tslab" ]; then
|
||||
cat >"$TEST_BIN_DIR/tslab" <<'TSLAB'
|
||||
#!/usr/bin/env bash
|
||||
echo "tslab $*" >>"$CALL_LOG"
|
||||
TSLAB
|
||||
chmod +x "$TEST_BIN_DIR/tslab"
|
||||
fi
|
||||
STUB
|
||||
write_tslab_stub
|
||||
cat >"$sandbox/jupyter" <<'STUB'
|
||||
#!/usr/bin/env bash
|
||||
if [ "$1" = "kernelspec" ] && [ "$2" = "list" ]; then
|
||||
cat "$JUPYTER_KERNELS"
|
||||
fi
|
||||
STUB
|
||||
chmod +x "$sandbox/npm" "$sandbox/jupyter"
|
||||
|
||||
extract_node_setup() {
|
||||
awk '
|
||||
/^tslab_kernels_installed\(\)/ {emit=1}
|
||||
emit {print}
|
||||
/^setup_node\(\)/ {in_setup=1}
|
||||
in_setup && /^}/ {exit}
|
||||
' "$script"
|
||||
}
|
||||
|
||||
run_setup_node() {
|
||||
CALL_LOG=$1 JUPYTER_KERNELS=$2 TEST_BIN_DIR="$sandbox" PATH="$sandbox:$PATH" bash -c "$(extract_node_setup); setup_node"
|
||||
}
|
||||
|
||||
call_log="$sandbox/calls-installed.log"
|
||||
kernels="$sandbox/kernels-installed.txt"
|
||||
cat >"$kernels" <<'KERNELS'
|
||||
Available kernels:
|
||||
python /usr/local/share/jupyter/kernels/python
|
||||
tslab /usr/local/share/jupyter/kernels/tslab
|
||||
jslab /usr/local/share/jupyter/kernels/jslab
|
||||
KERNELS
|
||||
run_setup_node "$call_log" "$kernels"
|
||||
if [ -s "$call_log" ]; then
|
||||
echo "expected no npm or tslab calls when kernels are already installed" >&2
|
||||
cat "$call_log" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
call_log="$sandbox/calls-missing-kernels.log"
|
||||
kernels="$sandbox/kernels-missing.txt"
|
||||
cat >"$kernels" <<'KERNELS'
|
||||
Available kernels:
|
||||
python /usr/local/share/jupyter/kernels/python
|
||||
KERNELS
|
||||
run_setup_node "$call_log" "$kernels"
|
||||
if grep -q '^npm install -g tslab$' "$call_log"; then
|
||||
echo "did not expect npm install when tslab command exists" >&2
|
||||
cat "$call_log" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! grep -q '^tslab install$' "$call_log"; then
|
||||
echo "expected tslab install when kernels are missing" >&2
|
||||
cat "$call_log" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
call_log="$sandbox/calls-partial-kernels.log"
|
||||
kernels="$sandbox/kernels-partial.txt"
|
||||
cat >"$kernels" <<'KERNELS'
|
||||
Available kernels:
|
||||
python /usr/local/share/jupyter/kernels/python
|
||||
tslab /usr/local/share/jupyter/kernels/tslab
|
||||
KERNELS
|
||||
run_setup_node "$call_log" "$kernels"
|
||||
if grep -q '^npm install -g tslab$' "$call_log"; then
|
||||
echo "did not expect npm install when tslab command exists" >&2
|
||||
cat "$call_log" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! grep -q '^tslab install$' "$call_log"; then
|
||||
echo "expected tslab install when one kernel is missing" >&2
|
||||
cat "$call_log" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm "$sandbox/tslab"
|
||||
call_log="$sandbox/calls-missing-command.log"
|
||||
run_setup_node "$call_log" "$kernels"
|
||||
if ! grep -q '^npm install -g tslab$' "$call_log"; then
|
||||
echo "expected npm install when tslab command is missing" >&2
|
||||
cat "$call_log" >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user