Skip to content

Commit b0d1291

Browse files
committed
fix: auto-start apiserver in tests and fix Angular bootstrap import
- Modified .check-apiserver to automatically start kube-apiserver if not running - Fixed Angular test import: use @angular/platform-browser for bootstrapApplication - Tests now work without requiring manual apiserver startup
1 parent e770768 commit b0d1291

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
"Bash(git mv:*)",
3939
"Bash(grep:*)",
4040
"WebFetch(domain:github.com)",
41-
"Bash(gh run view:*)"
41+
"Bash(gh run view:*)",
42+
"Bash(kill:*)",
43+
"Bash(pkill -f \"serve -l 3000\")"
4244
]
4345
}
4446
}

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ clean-all: clean stop-apiserver
5151
@rm -rf openapi-specs
5252
@echo "✓ Full cleanup complete"
5353

54-
# Internal function to check apiserver
54+
# Internal function to check apiserver (starts it if not running)
5555
.check-apiserver:
5656
@if ! docker ps | grep -q k8s-apiserver; then \
57-
echo "Error: kube-apiserver is not running."; \
58-
echo "Start it with: make 1.31 (or your desired version)"; \
59-
exit 1; \
57+
echo "kube-apiserver is not running, starting it..."; \
58+
K8S_VERSION=1.35 docker compose up -d || exit 1; \
59+
echo "Waiting for kube-apiserver to be ready..."; \
60+
sleep 30; \
6061
fi
6162
@echo "✓ kube-apiserver is running"
6263

@@ -73,7 +74,7 @@ test-angular:
7374
@$(MAKE) .install-playwright
7475
@echo ""
7576
@echo "Starting test server on port 4200..."
76-
@cd angular-tests && npx serve -l 4200 . > /tmp/angular-test-server.log 2>&1 & \
77+
@cd angular-tests && npx serve -l 4200 --no-request-logging --no-clipboard . > /tmp/angular-test-server.log 2>&1 & \
7778
SERVER_PID=$$!; \
7879
sleep 3; \
7980
yarn --cwd angular-tests run test || TEST_FAILED=1; \

angular-tests/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Angular integration test application
33
* Tests the @k8s-web/angular library by listing Kubernetes namespaces
44
*/
5-
import { bootstrapApplication } from '@angular/platform-browser-dynamic';
5+
import { bootstrapApplication } from '@angular/platform-browser';
66
import { Component, OnInit, inject } from '@angular/core';
77
import { CommonModule } from '@angular/common';
88
import { provideHttpClient, withInterceptors } from '@angular/common/http';

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353
dependencies:
5454
tslib "^2.3.0"
5555

56+
"@angular/platform-browser-dynamic@^17.0.0":
57+
version "17.3.12"
58+
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-17.3.12.tgz#a31b5187dfff8f68a79083f5e48b502e966423f4"
59+
integrity sha512-DQwV7B2x/DRLRDSisngZRdLqHdYbbrqZv2Hmu4ZbnNYaWPC8qvzgE/0CvY+UkDat3nCcsfwsMnlDeB6TL7/IaA==
60+
dependencies:
61+
tslib "^2.3.0"
62+
5663
"@angular/platform-browser@^17.0.0":
5764
version "17.3.12"
5865
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-17.3.12.tgz#ea03fd28b174ac33a5129f3580f606e449381ed1"

0 commit comments

Comments
 (0)