Skip to content

Commit 296a540

Browse files
Copilotpelikhan
andcommitted
Add org tests, pass GitHub token in workflow, and add integration Makefile target
Co-authored-by: pelikhan <[email protected]>
1 parent 78b652d commit 296a540

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

.github/workflows/integration.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ jobs:
3333
- name: Build gh-models binary
3434
run: make build
3535

36-
- name: Run integration tests (without auth)
36+
- name: Run integration tests
3737
working-directory: integration
3838
run: |
3939
go mod tidy
4040
go test -v -timeout=5m
4141
env:
42-
# Explicitly unset any GitHub tokens to test unauthenticated behavior
43-
GITHUB_TOKEN: ""
44-
GH_TOKEN: ""
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ build:
66
script/build
77
.PHONY: build
88

9+
integration: build
10+
@echo "==> running integration tests <=="
11+
cd integration && go test -v -timeout=5m
12+
.PHONY: integration
13+
914
fmt:
1015
@echo "==> running Go format <=="
1116
gofmt -s -l -w .

integration/integration_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,29 @@ func TestIntegrationRun(t *testing.T) {
219219
// which might be expensive for CI
220220
require.Contains(t, stdout, "Prompts the specified model")
221221
}
222+
223+
// TestIntegrationRunWithOrg tests the run command with --org flag
224+
func TestIntegrationRunWithOrg(t *testing.T) {
225+
if !hasAuthToken() {
226+
t.Skip("Skipping integration test - no GitHub authentication available")
227+
}
228+
229+
// Test run command with --org flag (using help to avoid expensive API calls)
230+
stdout, _, err := runCommand(t, "run", "--org", "test-org", "--help")
231+
require.NoError(t, err, "Run help with --org should work")
232+
require.Contains(t, stdout, "Prompts the specified model")
233+
require.Contains(t, stdout, "--org string")
234+
}
235+
236+
// TestIntegrationEvalWithOrg tests the eval command with --org flag
237+
func TestIntegrationEvalWithOrg(t *testing.T) {
238+
if !hasAuthToken() {
239+
t.Skip("Skipping integration test - no GitHub authentication available")
240+
}
241+
242+
// Test eval command with --org flag (using help to avoid expensive API calls)
243+
stdout, _, err := runCommand(t, "eval", "--org", "test-org", "--help")
244+
require.NoError(t, err, "Eval help with --org should work")
245+
require.Contains(t, stdout, "Runs evaluation tests against a model")
246+
require.Contains(t, stdout, "--org string")
247+
}

0 commit comments

Comments
 (0)