Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ make test SKIP_INSTALL=1
| Variable | Required | Description |
|----------|----------|-------------|
| `HICLAW_LLM_API_KEY` | Yes | LLM API key for Agent behavior |
| `HICLAW_GITHUB_TOKEN` | No | GitHub PAT for tests 08-11 |
| `AGENTTEAMS_GITHUB_TOKEN` | No | GitHub PAT for tests 08-13 (`HICLAW_GITHUB_TOKEN` remains supported) |

## Helper Libraries

Expand Down
3 changes: 3 additions & 0 deletions tests/lib/test-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export TEST_GATEWAY_PORT="${TEST_GATEWAY_PORT:-18080}"
export TEST_CONSOLE_PORT="${TEST_CONSOLE_PORT:-18001}"
export TEST_ELEMENT_PORT="${TEST_ELEMENT_PORT:-18088}"

# Prefer the current installer contract while retaining test and legacy overrides.
export TEST_GITHUB_TOKEN="${TEST_GITHUB_TOKEN:-${AGENTTEAMS_GITHUB_TOKEN:-${HICLAW_GITHUB_TOKEN:-}}}"

# Internal container URLs — always fixed; all callers use exec_in_manager
export TEST_MATRIX_DIRECT_URL="http://127.0.0.1:6167"
export TEST_MINIO_URL="http://127.0.0.1:9000"
Expand Down
3 changes: 3 additions & 0 deletions tests/run-all-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export TEST_REGISTRATION_TOKEN="${TEST_REGISTRATION_TOKEN:-test-reg-token-$(open
export TEST_MATRIX_DOMAIN="${TEST_MATRIX_DOMAIN:-matrix-local.agentteams.io:18080}"
export TEST_MANAGER_HOST="${TEST_MANAGER_HOST:-127.0.0.1}"
export HICLAW_LLM_API_KEY="${HICLAW_LLM_API_KEY:-${AGENTTEAMS_LLM_API_KEY:-}}"
export TEST_GITHUB_TOKEN="${TEST_GITHUB_TOKEN:-${AGENTTEAMS_GITHUB_TOKEN:-${HICLAW_GITHUB_TOKEN:-}}}"

# Parse arguments
while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -60,6 +61,7 @@ load_env_file() {
AGENTTEAMS_REGISTRATION_TOKEN) export TEST_REGISTRATION_TOKEN="${value}" ;;
AGENTTEAMS_MATRIX_DOMAIN) export TEST_MATRIX_DOMAIN="${value}" ;;
AGENTTEAMS_LLM_API_KEY) [ -z "${HICLAW_LLM_API_KEY}" ] && export HICLAW_LLM_API_KEY="${value}" ;;
AGENTTEAMS_GITHUB_TOKEN) [ -z "${TEST_GITHUB_TOKEN}" ] && export TEST_GITHUB_TOKEN="${value}" ;;
AGENTTEAMS_PORT_GATEWAY) export TEST_GATEWAY_PORT="${value}" ;;
AGENTTEAMS_PORT_CONSOLE) export TEST_CONSOLE_PORT="${value}" ;;
HICLAW_ADMIN_USER) export TEST_ADMIN_USER="${value}" ;;
Expand All @@ -69,6 +71,7 @@ load_env_file() {
HICLAW_REGISTRATION_TOKEN) export TEST_REGISTRATION_TOKEN="${value}" ;;
HICLAW_MATRIX_DOMAIN) export TEST_MATRIX_DOMAIN="${value}" ;;
HICLAW_LLM_API_KEY) [ -z "${HICLAW_LLM_API_KEY}" ] && export HICLAW_LLM_API_KEY="${value}" ;;
HICLAW_GITHUB_TOKEN) [ -z "${TEST_GITHUB_TOKEN}" ] && export TEST_GITHUB_TOKEN="${value}" ;;
HICLAW_PORT_GATEWAY) export TEST_GATEWAY_PORT="${value}" ;;
HICLAW_PORT_CONSOLE) export TEST_CONSOLE_PORT="${value}" ;;
esac
Expand Down
4 changes: 2 additions & 2 deletions tests/skills/hiclaw-test/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Test cases:
- **test-04**: Human intervention with additional instructions
- **test-05**: Heartbeat query mechanism
- **test-06**: Multi-Worker collaboration
- **test-08~14**: GitHub/MCP related tests (requires HICLAW_GITHUB_TOKEN)
- **test-08~14**: GitHub/MCP related tests (requires `AGENTTEAMS_GITHUB_TOKEN`)

### Step 3: Individual Install/Uninstall

Expand Down Expand Up @@ -165,7 +165,7 @@ timeout 1200 ./tests/run-all-tests.sh --skip-build --use-existing
[36m[TEST INFO][0m SKIP: No GitHub token configured
```

Requires `HICLAW_GITHUB_TOKEN` environment variable.
Set `AGENTTEAMS_GITHUB_TOKEN` before running these tests. The legacy `HICLAW_GITHUB_TOKEN` variable remains supported.

### Metrics Files

Expand Down
37 changes: 37 additions & 0 deletions tests/unit/test-github-token-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
HELPER="${HELPER:-${SCRIPT_DIR}/../lib/test-helpers.sh}"
ORCHESTRATOR="${ORCHESTRATOR:-${SCRIPT_DIR}/../run-all-tests.sh}"

assert_token() {
local expected="$1"
local test_token="$2"
local agentteams_token="$3"
local legacy_token="$4"
local actual

actual=$(TEST_GITHUB_TOKEN="${test_token}" \
AGENTTEAMS_GITHUB_TOKEN="${agentteams_token}" \
HICLAW_GITHUB_TOKEN="${legacy_token}" \
HELPER="${HELPER}" \
bash -c 'docker() { return 1; }; source "${HELPER}"; printf "%s" "${TEST_GITHUB_TOKEN}"')

if [ "${actual}" != "${expected}" ]; then
echo "FAIL: expected token ${expected}, got ${actual:-<empty>}" >&2
exit 1
fi
}

assert_token canonical '' canonical legacy
assert_token explicit explicit canonical legacy
assert_token legacy '' '' legacy

if ! grep -q 'AGENTTEAMS_GITHUB_TOKEN)' "${ORCHESTRATOR}"; then
echo "FAIL: orchestrator does not load AGENTTEAMS_GITHUB_TOKEN from the env file" >&2
exit 1
fi

echo "PASS: GitHub test token honors explicit, AgentTeams, and legacy inputs"
Loading