|
| 1 | +#!/bin/bash |
| 2 | +set -e |
| 3 | + |
| 4 | +# Test script for antigravity-nix feature |
| 5 | +echo "=== Testing antigravity-nix feature ===" |
| 6 | + |
| 7 | +# Test 1: Check vscode user exists |
| 8 | +echo "Test 1: Checking vscode user exists..." |
| 9 | +id vscode || (echo "FAIL: vscode user not found" && exit 1) |
| 10 | +echo "PASS: vscode user exists" |
| 11 | + |
| 12 | +# Test 2: Check vscode can sudo without password |
| 13 | +echo "Test 2: Checking passwordless sudo..." |
| 14 | +sudo -n true || (echo "FAIL: passwordless sudo not working" && exit 1) |
| 15 | +echo "PASS: passwordless sudo works" |
| 16 | + |
| 17 | +# Test 3: Check Nix is installed |
| 18 | +echo "Test 3: Checking Nix installation..." |
| 19 | +if [ -e '/home/vscode/.nix-profile/etc/profile.d/nix.sh' ]; then |
| 20 | + . '/home/vscode/.nix-profile/etc/profile.d/nix.sh' |
| 21 | +fi |
| 22 | +nix --version || (echo "FAIL: nix not found" && exit 1) |
| 23 | +echo "PASS: Nix is installed" |
| 24 | + |
| 25 | +# Test 4: Check flakes are enabled |
| 26 | +echo "Test 4: Checking flakes are enabled..." |
| 27 | +nix flake --help > /dev/null 2>&1 || (echo "FAIL: flakes not enabled" && exit 1) |
| 28 | +echo "PASS: Flakes are enabled" |
| 29 | + |
| 30 | +# Test 5: Check essential commands exist |
| 31 | +echo "Test 5: Checking essential commands..." |
| 32 | +for cmd in git wget curl sudo ps; do |
| 33 | + command -v $cmd > /dev/null 2>&1 || (echo "FAIL: $cmd not found" && exit 1) |
| 34 | + echo " - $cmd: OK" |
| 35 | +done |
| 36 | +echo "PASS: All essential commands available" |
| 37 | + |
| 38 | +echo "" |
| 39 | +echo "=== All tests passed! ===" |
0 commit comments