Skip to content

Commit 8a1c52e

Browse files
authored
Merge pull request #6 from constructive-io/dev/testing-strategy
Dev/testing strategy using a matrix
2 parents f4a6de2 + d976edd commit 8a1c52e

4 files changed

Lines changed: 35 additions & 3 deletions

File tree

.github/workflows/test-k8s-deployment.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ jobs:
2525
k8s-ci-test:
2626
runs-on: ubuntu-latest
2727
timeout-minutes: 45
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
function:
32+
- hello-world
33+
- llm-internal-calvin
34+
- opencode-headless
35+
- twilio-sms
36+
- llm-external
37+
- send-email-link
38+
- crypto-login
39+
- github-repo-creator
40+
- pytorch-gpu
41+
- runtime-script
42+
- rust-hello-world
43+
- simple-bash
44+
- simple-email
45+
- stripe-function
2846

2947
steps:
3048
- name: Checkout
@@ -212,7 +230,7 @@ jobs:
212230
- name: Run K8s Tests
213231
run: |
214232
# Ensure kubectl proxy port is available or managed by the runner
215-
make test-k8s-all
233+
pnpm exec ts-node scripts/test-runner.ts --function ${{ matrix.function }}
216234
217235
218236
- name: Dump diagnostics on failure

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,12 @@ test-llm-external:
7474

7575
test-email:
7676
pnpm exec ts-node scripts/test-runner.ts --function send-email-link
77+
78+
# Cleanup K8s Resources
79+
k8s-clean:
80+
@echo "Cleaning up K8s jobs for constructive-functions..."
81+
# Delete all jobs matching test-* or *-exec-* pattern (batch delete)
82+
@kubectl get jobs -n default --no-headers -o custom-columns=":metadata.name" | grep -E "^test-|-exec-" | xargs kubectl delete job -n default --ignore-not-found || true
83+
# Delete all pods matching test-* or *-exec-* pattern (orphaned pods) (batch delete)
84+
@kubectl get pods -n default --no-headers -o custom-columns=":metadata.name" | grep -E "^test-|-exec-" | xargs kubectl delete pod -n default --ignore-not-found || true
85+
@echo "Done."

functions/_runtimes/node/runner.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ const run = async () => {
7474
}
7575

7676
// 4. Setup GraphQL Client
77-
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT || 'http://constructive-server:3000/graphql');
77+
const graphqlEndpoint = process.env.GRAPHQL_ENDPOINT || 'http://constructive-server:3000/graphql';
78+
if (!process.env.GRAPHQL_ENDPOINT) {
79+
// Warn if falling back, to aid debugging
80+
console.warn(`[runner] GRAPHQL_ENDPOINT not set, defaulting to internal k8s service: ${graphqlEndpoint}`);
81+
}
82+
const client = new GraphQLClient(graphqlEndpoint);
7883

7984
// 5. Setup Route
8085
app.post('/', async (req, res) => {

functions/llm-internal-calvin/__tests__/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('LLM Internal Calvin Function (Integration)', () => {
8686
imagePullPolicy: "IfNotPresent",
8787
command: ["npx", "ts-node", "functions/_runtimes/node/runner.js", "functions/llm-internal-calvin/src/index.ts"],
8888
env: [
89-
{ name: "CALVIN_API_KEY", value: "42ee96e2cf9c616c81f5b361b36c899d7bda0e1495fb4b98b46a208c923c35e7" },
89+
{ name: "CALVIN_API_KEY", value: process.env.CALVIN_API_KEY },
9090
{ name: "PORT", value: "8080" }
9191
]
9292
}]

0 commit comments

Comments
 (0)