Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e9e1f87
Fetch state from aas-release-branch "service-key-creation"
joergdw Nov 1, 2025
e7390d6
Adapt gitignore and fix linting-message regarding java-indentation;
joergdw Nov 3, 2025
7292d3f
Merge remote-tracking branch 'os-origin/main' into service-key-creation
joergdw Nov 10, 2025
d9b73f8
🔧 Fix `make clean`;
joergdw Nov 10, 2025
7051f69
🔧 Fix certificate-location in tests;
joergdw Nov 10, 2025
593a083
🔧 Fix ginkgo-argument-order and use devbox-gingko!
joergdw Nov 10, 2025
7b069f5
🔧 Fix more test-cert-paths;
joergdw Nov 10, 2025
4961121
🔧 Fix output-style;
joergdw Nov 11, 2025
10429c2
🔧 Fix error-matching-situation due to an erroneous implementation of …
joergdw Nov 12, 2025
c7d46b9
Merge remote-tracking branch 'os-origin/main' into service-key-creation
joergdw Nov 12, 2025
a90a8f7
Make linter happy;
joergdw Nov 12, 2025
7ffc3bf
Generate fakes only if not already present!
joergdw Nov 12, 2025
1aecd22
🔧 Fix tests;
joergdw Nov 12, 2025
08e7749
🚧 Work in progress: Debug disk-usage-scenario;
joergdw Nov 12, 2025
4c8fabf
Add test-case for service-key-creation;
joergdw Nov 17, 2025
d02e286
Build gorouter-proxy if and only if necessary to speedup tests;
joergdw Nov 17, 2025
7319fe2
Preparation for multiple schema-variants;
joergdw Nov 17, 2025
f6b8e28
Require schema-version when creating a service-key;
joergdw Nov 18, 2025
1cef624
Expect a schema-version in pure service-key-requests;
joergdw Nov 18, 2025
d968d6b
Fix test-case;
joergdw Nov 18, 2025
98173de
🔧 Fix acceptance-tests
joergdw Nov 19, 2025
aceb65e
Merge remote-tracking branch 'os-origin/main' into service-key-creation
joergdw Nov 19, 2025
829e565
🔧 Fix acceptance-tests;
joergdw Nov 19, 2025
6bb6716
Merge remote-tracking branch 'os-origin/main' into service-key-creation
joergdw Nov 21, 2025
431fbf2
🧹 Clean-up;
joergdw Nov 21, 2025
7b5af98
Introduce test for misuse of the quite open legacy-schema to smuggle …
joergdw Nov 21, 2025
631a19e
Enforce that old schema does not know the app_guid;
joergdw Nov 21, 2025
3e4c0d5
Enforce legacy-schema to not offer a sensible ~schema-version~-Parame…
joergdw Nov 21, 2025
e2b2214
🔧 Fix test;
joergdw Nov 21, 2025
e035f2f
Re-ordering of test-cases;
joergdw Nov 24, 2025
d261c3f
🔧 Fix error in changed json-schema.
joergdw Nov 24, 2025
ee60444
🛠️ Preparation for the client-communication within the broker;
joergdw Nov 24, 2025
74c34aa
More concurrency-robustness for two tests;
joergdw Nov 24, 2025
cb6674d
Add test-case for app-space-miss-alignment;
joergdw Nov 24, 2025
9cf8835
🔧 Fix new test for ensuring that the app is in the space.
joergdw Nov 24, 2025
e46b8dc
Introduce handling in case the cloud-controller does not provide bind…
joergdw Nov 25, 2025
d1016de
Make the linter happy;
joergdw Nov 25, 2025
6c175d2
🧹 Clean-up;
joergdw Nov 25, 2025
17783f3
Factor out helper-method;
joergdw Nov 25, 2025
2767c75
🔧 Fixes two important issues
joergdw Nov 25, 2025
4a573ea
Rename schema-file according to proposal in PR-comment
joergdw Nov 25, 2025
7ed70cc
Adds test for space-guid-comparison against the binding-db.
joergdw Nov 25, 2025
d8c9ebd
🔧 Fix test;
joergdw Nov 25, 2025
b52fd53
Rename schema-file for version-id-inclusion;
joergdw Nov 25, 2025
6a1fc3f
Fix potential nullpointer-issue;
joergdw Nov 25, 2025
9ea5751
🩹 Fix ~additionalProperties~-error;
joergdw Nov 25, 2025
3f696f8
Switch to internal-server-error in case of a json-schema error-serial…
joergdw Nov 26, 2025
9ef8625
Improve readability of ~checkAppInSpace~;
joergdw Nov 26, 2025
4d1e5d9
Allow only exactly one schema to be valid at a certain point in time.
joergdw Nov 26, 2025
58ae449
Improve comment and make validator-usage more understandable;
joergdw Nov 26, 2025
5f7945b
Switch schema-version-numbering-start to "0.1" instead of "0.9"
joergdw Nov 27, 2025
85ba3f7
Minor makefile-improvements;
joergdw Nov 28, 2025
be2a3fe
Add simple acceptance-test for service-key-creation;
joergdw Nov 28, 2025
561d8a9
Make linter happy;
joergdw Nov 28, 2025
bba5f1f
Intentionally make the borker-acceptance-tests fail to see if they work!
joergdw Nov 28, 2025
16ee55d
Add test-case to validate if application gets scaled as well via serv…
joergdw Nov 28, 2025
4acc63d
Move scaling-test for service-keys to the app-tests;
joergdw Nov 28, 2025
2b336c7
Fix syntactic error and minor changes;
joergdw Nov 28, 2025
d76e9ac
Fix import-error and shorten service-key-name;
joergdw Nov 28, 2025
84688c5
Fix error; instance-name overwritten;
joergdw Nov 28, 2025
93334f4
🚧 Work in progress: Test with other space-name;
joergdw Nov 28, 2025
9e1fafb
Switch dynamic test to a disk-usage-test;
joergdw Dec 1, 2025
55fb661
Complete dynamic-scaling-tests for service-key scenarios and fix erro…
joergdw Dec 1, 2025
4d978cc
🔧 Fix error in configuration-parsing and experiment with acceptance-t…
joergdw Dec 1, 2025
85550c2
🔧 Fix acceptance-tests for the broker.
joergdw Dec 1, 2025
577045d
Fix disk-usage-test;
joergdw Dec 2, 2025
6f78856
⌛ Increase waiting-time;
joergdw Dec 2, 2025
f4f1484
🖍️ Fix typing errors;
joergdw Dec 2, 2025
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
37 changes: 18 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
# ==================== 🏗️ Build- and test-artefacts ====================
api/default_catalog.json
build/
fakes/*
mta_archives/
api/default_catalog.json
mta.yaml
*.mta
Makefile_*

api/cmd/api/api
scalingengine/cmd/scalingengine/scalingengine

# Generated api-clients:
acceptance/assets/app/go_app/internal/applicationmetric/oas*gen.go
acceptance/assets/app/go_app/internal/custommetrics/oas*gen.go
acceptance/assets/app/go_app/internal/policy/oas*gen.go
api/apis/scalinghistory/oas*gen.go
scalingengine/apis/scalinghistory/oas*gen.go

keys
mta.yaml
mta_archives/
*.out*
target/
test-certs
*.out

**/*.test

vendor

# ==================== 📦 Devbox, ❄ Nix, direnv ====================
.devbox
devbox.d/

keys
# ==================== 🏭 Generated api-clients ====================
acceptance/assets/app/go_app/internal/applicationmetric/oas*gen.go
acceptance/assets/app/go_app/internal/custommetrics/oas*gen.go
acceptance/assets/app/go_app/internal/policy/oas*gen.go
api/apis/scalinghistory/oas*gen.go
scalingengine/apis/scalinghistory/oas*gen.go

# # ==================== 🧹 Probably not needed anymore ====================
# api/cmd/api/api
# scalingengine/cmd/scalingengine/scalingengine
# Makefile_*
89 changes: 54 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
MAKEFLAGS := -s
aes_terminal_font_yellow := \e[38;2;255;255;0m
aes_terminal_reset := \e[0m
aes_terminal_font_yellow := \033[38;2;255;255;0m
aes_terminal_reset := \033[0m
VERSION ?= 0.0.0-rc.1
DEST ?= /tmp/build
MTAR_FILENAME ?= app-autoscaler-release-v$(VERSION).mtar
Expand Down Expand Up @@ -50,7 +50,7 @@ binaries=$(shell find . -name "main.go" -exec dirname {} \; | cut -d/ -f2 | sor
test_dirs=$(shell find . -name "*_test.go" -exec dirname {} \; | cut -d/ -f2 | sort | uniq)
export GO111MODULE=on

.PHONY: clean-dbtasks package-dbtasks vendor-changelogs clean-scheduler package-scheduler clean mta-deploy mta-undeploy mta-build mta-logs
.PHONY: dbtasks.clean package-dbtasks vendor-changelogs scheduler.clean package-scheduler clean mta-deploy mta-undeploy mta-build mta-logs

GINKGO_OPTS = -r --race --require-suite --randomize-all --cover ${OPTS}

Expand Down Expand Up @@ -85,19 +85,26 @@ ${openapi-generated-clients-and-servers-api-dir} ${openapi-generated-clients-and
go generate ./api/apis/generate.go || true
go generate ./scalingengine/apis/generate.go || true


.PHONY: generate-fakes
generate-fakes: autoscaler.generate-fakes test-app.generate-fakes

# The presence of the subsequent directory indicates whether the fakes still need to be generated
# or not.
app-fakes-dir := ./fakes
app-fakes-files = $(wildcard ${app-fakes-dir}/*.go)

.PHONY: generate-fakes autoscaler.generate-fakes test-app.generate-fakes
generate-fakes: autoscaler.generate-fakes test-app.generate-fakes

autoscaler.generate-fakes:
@echo "# Generating counterfeits"
fake-relevant-go-files = $(shell rg --hidden --glob='!/acceptance' --glob='!/fakes' \
--glob='!/integration' --glob='!/target' --glob='!/test-certs' --glob='!/testhelpers' --glob='!**/*_test.go'\
--type='go' --files-with-matches --regexp='')
.PHONY: autoscaler.generate-fakes
autoscaler.generate-fakes: ${app-fakes-dir} ${app-fakes-files}
${app-fakes-dir} ${app-fakes-files} &: ./go.mod ./go.sum ${fake-relevant-go-files}
@echo '# Generating counterfeits'
mkdir -p '${app-fakes-dir}'
COUNTERFEITER_NO_GENERATE_WARNING='true' GOFLAGS='-mod=mod' go generate './...'
@touch '${app-fakes-dir}' # Ensure that the folder-modification-timestamp gets updated.

.PHONY: test-app.generate-fakes
test-app.generate-fakes:
make --directory='acceptance/assets/app/go_app' generate-fakes

Expand All @@ -118,18 +125,17 @@ go_deps_without_generated_sources = $(shell find . -type f -name '*.go' \
# 4. Optionally: `make generate-fakes` to update the fakes as well.
.PHONY: go-mod-tidy
go-mod-tidy: ./go.mod ./go.sum ${go_deps_without_generated_sources} acceptance.go-mod-tidy test-app.go-mod-tidy



@echo -ne '${aes_terminal_font_yellow}'
@echo -e '⚠️ Warning: The client-fakes generated from the openapi-specification may be\n' \
'outdated. Please consider re-generating them, if this is relevant.'
@echo -ne '${aes_terminal_reset}'
@echo -ne '${aes_terminal_font_yellow}' \
'⚠️ Warning: The client-fakes generated from the openapi-specification may be\n' \
'outdated. Please consider re-generating them, if this is relevant.' \
'${aes_terminal_reset}'
go mod tidy

.PHONY: acceptance.go-mod-tidy
acceptance.go-mod-tidy:
make --directory='acceptance' go-mod-tidy

.PHONY: test-app.go-mod-tidy
test-app.go-mod-tidy:
make --directory='acceptance/assets/app/go_app' go-mod-tidy

Expand Down Expand Up @@ -171,21 +177,24 @@ check: fmt lint build test

test: autoscaler.test scheduler.test test-acceptance-unit ## Run all unit tests

autoscaler.test: check-db_type init-db test-certs generate-fakes
autoscaler.test: check-db_type init-db test-certs generate-fakes build-gorouterproxy
@echo ' - using DBURL=${DBURL} TEST=${TEST}'
APP_AUTOSCALER_TEST_RUN='true' DBURL='${DBURL}' go run github.com/onsi/ginkgo/v2/ginkgo -p ${GINKGO_OPTS} ${TEST} --skip-package='integration,acceptance'
APP_AUTOSCALER_TEST_RUN='true' DBURL='${DBURL}' ginkgo run -p ${GINKGO_OPTS} --skip-package='integration,acceptance' ${TEST}

test-autoscaler-suite: check-db_type init-db test-certs build-gorouterproxy
@echo " - using DBURL=${DBURL} TEST=${TEST}"
APP_AUTOSCALER_TEST_RUN='true' DBURL='${DBURL}' go run github.com/onsi/ginkgo/v2/ginkgo -p ${GINKGO_OPTS} ${TEST}
APP_AUTOSCALER_TEST_RUN='true' DBURL='${DBURL}' ginkgo run -p ${GINKGO_OPTS} ${TEST}

test-acceptance-unit:
@make --directory=acceptance test-unit

gorouter-proxy.program := ./build/gorouterproxy
gorouter-proxy.source := integration/gorouterproxy/main.go
.PHONY: build-gorouterproxy
build-gorouterproxy:
build-gorouterproxy: ${gorouter-proxy.program}
${gorouter-proxy.program}: ./go.mod ./go.sum ${gorouter-proxy.source}
@echo "# building gorouterproxy"
@CGO_ENABLED=1 go build $(BUILDTAGS) $(BUILDFLAGS) -o build/gorouterproxy integration/gorouterproxy/main.go
@CGO_ENABLED=1 go build $(BUILDTAGS) $(BUILDFLAGS) -o '${gorouter-proxy.program}' '${gorouter-proxy.source}'

.PHONY: integration
integration: generate-fakes init-db test-certs build_all build-gorouterproxy
Expand Down Expand Up @@ -222,15 +231,9 @@ lint: generate-fakes
echo "Linting with Golang $${GOVERSION}" ;\
golangci-lint run --config='.golangci.yaml' ${OPTS}

clean-dbtasks:
pushd dbtasks; mvn clean; popd

package-dbtasks:
pushd dbtasks; mvn --quiet package ${MVN_OPTS}; popd

clean-scheduler:
pushd scheduler; mvn clean; popd

build-scheduler:
pushd scheduler; mvn package -Dmaven.test.skip=true; popd

Expand All @@ -241,13 +244,21 @@ vendor-changelogs:
cp $(MAKEFILE_DIR)/scalingengine/db/* $(MAKEFILE_DIR)/dbtasks/src/main/resources/.
cp $(MAKEFILE_DIR)/scheduler/db/* $(MAKEFILE_DIR)/dbtasks/src/main/resources/.

clean:
clean: dbtasks.clean scheduler.clean
@echo "# cleaning autoscaler"
@rm --force --recursive "${openapi-generated-clients-and-servers-api-dir}"
@rm --force --recursive "${openapi-generated-clients-and-servers-scalingengine-dir}"
@go clean -cache -testcache
@rm --force --recursive 'fakes'
@rm --force --recursive 'test-certs'
@rm --force --recursive 'target'
@rm --force --recursive 'vendor'
@rm --force --recursive "${openapi-generated-clients-and-servers-api-dir}"
@rm --force --recursive "${openapi-generated-clients-and-servers-scalingengine-dir}"

dbtasks.clean:
pushd dbtasks; mvn clean; popd

scheduler.clean:
pushd scheduler; mvn clean; popd

mta-deploy: mta-build build-extension-file
$(MAKE) -f metricsforwarder/Makefile set-security-group
Expand Down Expand Up @@ -324,8 +335,10 @@ start-db: check-db_type target/start-db-${db_type}_CI_${CI} waitfor_${db_type}_C

.PHONY: waitfor_postgres_CI_false waitfor_postgres_CI_true
target/start-db-postgres_CI_false:
@if [ ! "$(shell docker ps -q -f name="^${db_type}")" ]; then \
if [ "$(shell docker ps -aq -f status=exited -f name="^${db_type}")" ]; then \
if [ ! "$(shell docker ps -q -f name="^${db_type}")" ] ;\
then \
if [ "$(shell docker ps -aq -f status=exited -f name="^${db_type}")" ]; \
then \
docker rm ${db_type}; \
fi;\
echo " - starting docker for ${db_type}";\
Expand All @@ -340,7 +353,9 @@ target/start-db-postgres_CI_false:
-d \
postgres:${POSTGRES_TAG} \
-c 'max_connections=1000' >/dev/null;\
else echo " - $@ already up'"; fi;
else \
echo " - $@ already up'";\
fi;
@mkdir -p target
@touch $@

Expand All @@ -351,6 +366,7 @@ waitfor_postgres_CI_false:
@echo -n " - waiting for ${db_type} ."
@COUNTER=0; until $$(docker exec postgres pg_isready &>/dev/null) || [ $$COUNTER -gt 10 ]; do echo -n "."; sleep 1; let COUNTER+=1; done;\
if [ $$COUNTER -gt 10 ]; then echo; echo "Error: timed out waiting for postgres. Try \"make clean\" first." >&2 ; exit 1; fi

waitfor_postgres_CI_true:
@echo " - no ci postgres checks"

Expand Down Expand Up @@ -461,14 +477,17 @@ acceptance-cleanup:
acceptance-tests-config:
make --directory='acceptance' acceptance-tests-config

# 🚧 To-do: These targets don't exist here!
.PHONY: deploy-autoscaler deploy-autoscaler-bosh

.PHONY: deploy-autoscaler deploy-register-cf deploy-autoscaler-bosh deploy-cleanup

.PHONY: deploy-register-cf
deploy-register-cf:
DEBUG="${DEBUG}" ./scripts/register-broker.sh

.PHONY: deploy-cleanup
deploy-cleanup:
DEBUG="${DEBUG}" ./scripts/cleanup-autoscaler.sh

.PHONY: deploy-apps
deploy-apps:
DEBUG="${DEBUG}" ./scripts/deploy-apps.sh
14 changes: 10 additions & 4 deletions acceptance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,22 @@ lint:
golangci-lint run --config='${GOLANGCI_CONF}' ${OPTS}


acceptance-config-path := ./acceptance_config.json

# The subsequent target should always stay a target-filepath-aware target, to not overwrite manual
# changes.
.PHONY: acceptance-tests-config
acceptance-tests-config:
@ACCEPTANCE_CONFIG_PATH='./acceptance_config.json' ${MAKEFILE_DIR}/../scripts/acceptance-tests-config.sh
acceptance-tests-config: ${acceptance-config-path}
${acceptance-config-path}:
@ACCEPTANCE_CONFIG_PATH='${acceptance-config-path}' ${MAKEFILE_DIR}/../scripts/acceptance-tests-config.sh
@echo '✏️ Configuration for acceptance-tests written to file "${acceptance-config-path}"!'


.PHONY: run-acceptance-tests
run-acceptance-tests:
run-acceptance-tests: acceptance-tests-config
@${MAKEFILE_DIR}/../scripts/run-acceptance-tests.sh


.PHONY: acceptance-tests-cleanup
acceptance-tests-cleanup:
acceptance-tests-cleanup: acceptance-tests-config
@${MAKEFILE_DIR}/../scripts/cleanup-acceptance.sh
4 changes: 2 additions & 2 deletions acceptance/api/api_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ var _ = BeforeSuite(func() {
helpers.EnableCFTrace(cfg, componentName)
}

otherConfig := *cfg
otherConfig := cfg.Clone()
otherConfig.NamePrefix = otherConfig.NamePrefix + "_other"

By("Setup test environment")
setup = workflowhelpers.NewTestSuiteSetup(cfg)
otherSetup = workflowhelpers.NewTestSuiteSetup(&otherConfig)
otherSetup = workflowhelpers.NewTestSuiteSetup(otherConfig)

otherSetup.Setup()
setup.Setup()
Expand Down
Loading
Loading