Skip to content

Commit 3b86c3a

Browse files
authored
Harden the BanyanDB rotation e2e and stabilize K8sInfoRegistryTest (#14184)
* Harden the BanyanDB rotation e2e: topology before rotating, writes after The credentials rotation case now waits for the provider dependency before it rotates, as the CA rotation case does since #14181. Its incomplete credentials make BanyanDB reject writes for about ten seconds; when the OAP's first flush of the provider:9090 network address alias fell in that window, the bulk writer had already completed the write (it does so on send), the unchanged alias was not rewritten for five minutes, and the provider dependency missed the consumer's CLIENT side past the retry budget. Both cases also prove that writes go through after the rotation. Their topology assertions use swctl's default range, the last 30 minutes, which rows written before the rotation satisfy too. The step where the last rotation takes effect (credentials restored; the rebuild that trusts the new CA only) records its time once in the OAP container, and a final check asks for the provider topology from the next minute on only. Claude-Session: https://claude.ai/code/session_01HB9k74NvEPgCxFzHcyz58H * Bound K8sInfoRegistryTest's waits by the regressions, not the timeout plus 500 ms aStepWaitsForAllItsPodsWithinOneTimeout failed on the macOS runner with 2547 and 2567 ms against "under the 2 s timeout + 500 ms": the runner adds about 550 ms on top of the timeout, and a longer timeout would carry the same overhead. Its upper bound is now the 3.5 s five reads take one after another, which waiting for every read reaches and waiting the timeout per pod exceeds. stepsOverTheSamePodsWaitTheTimeoutAtMostInAllWhileALimitedQueueDrains had the same 500 ms margin; it now allows 1.5 s, under the 4.2 s its six reads take one after another and the timeout per step. The lower bound is unchanged.
1 parent f4d38fd commit 3b86c3a

4 files changed

Lines changed: 42 additions & 5 deletions

File tree

‎docs/en/changes/changes.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Replace the GenAI e2e cases' Spring AI application with an in-repo `e2e-spring-ai-service` module pinned to the released Spring AI 2.0.1, and move the mock LLM endpoints out of `e2e-service-provider` into a dedicated `e2e-mock-llm-server` module that all three GenAI cases share. The Spring AI application was previously built at test time by cloning `spring-projects/spring-ai-examples` and running Maven inside the image build, which resolved `spring-ai:2.0.0-SNAPSHOT`: a line that has since been abandoned, whose surviving builds all predate the 2.0.0 GA by a day and whose older builds have been pruned, so the fixture was pinned to nothing released and could no longer be rebuilt from the same bytes. Both modules are built by the existing e2e reactor and published to `ghcr.io/apache/skywalking` alongside the other e2e service images; `e2e-spring-ai-service` needs Java 17 and Spring Boot 4, so it is gated behind a new `jdk-17` profile in the e2e reactor and the jobs that build it now pin JDK 17 explicitly; `make -C test docker` refuses up front on an older JDK rather than packaging a missing or stale jar, since `clean` never reaches a module the profile excluded and compose would turn the absent jar into a directory.
66
* Add the Envoy project's NOTICE to `NOTICE` and to the binary distribution's NOTICE, for the Envoy proto files SkyWalking bundles in `receiver-proto`.
77
* The BanyanDB CA rotation e2e rotates the way an operator does: once the topology shows the consumer's calls to the provider, the OAP trusts the old and the new CA, BanyanDB reloads a certificate the new CA signed, and the OAP then trusts the new CA only, before the storage assertions run. Each step writes its file once, and the OAP's trust file is renamed into place, so the file monitor never reads it half-written. The rotation to an unrelated CA, which proves a rebuilt channel uses the trust file, moves to the end. It used to run first, and when the writes it fails included a network address alias's first write, the alias stayed out of storage until its next refresh five minutes later, so the topology assertions timed out.
8+
* The BanyanDB credentials rotation e2e waits for the topology to show the consumer's calls to the provider before it rotates, as the CA rotation e2e does. The incomplete credentials it applies fail the writes in that window, and when they included a network address alias's first write, the alias stayed out of storage until its next refresh five minutes later, so the topology assertions timed out.
9+
* The BanyanDB credentials and CA rotation e2e cases now also prove that writes go through after the rotation. Their topology assertions use the default range, the last 30 minutes, which rows written before the rotation satisfy too, so they only showed that queries work on the rotated credentials or channel. Each case now keeps the time its last rotation took effect and asserts the provider topology drawn only from the minutes after it.
810

911
#### OAP Server
1012
* Add customizable LLM-as-judge support for AI evaluation, with OpenAI-compatible endpoint / model / API key configuration, and persist the evaluation result as queryable `GenAIEvaluationRecord` rows for later inspection.

‎oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/v2/k8s/K8sInfoRegistryTest.java‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,13 @@ public void aStepWaitsForAllItsPodsWithinOneTimeout() {
100100
K8sInfoRegistry.getInstance().readServicesOfPods(keys);
101101
final long elapsedMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
102102

103-
// Five reads of 700 ms one after another take 3.5 s; the step waits the 2 s timeout at most.
103+
// Five reads of 700 ms one after another take 3.5 s; the step waits the 2 s timeout at most. The bound is the
104+
// 3.5 s rather than the timeout plus a margin, which a loaded runner overruns (2547 and 2567 ms on macOS).
104105
final long timeout = K8sMetadataReadSettings.getMalReadTimeoutMillis();
105-
assertTrue(elapsedMillis >= timeout - 100 && elapsedMillis < timeout + 500, "waited " + elapsedMillis + " ms");
106+
assertTrue(
107+
elapsedMillis >= timeout - 100 && elapsedMillis < READ_MILLIS * keys.size(),
108+
"waited " + elapsedMillis + " ms"
109+
);
106110
assertEquals("web.default", K8sInfoRegistry.getInstance().findServiceName("default", prefix + 0));
107111
}
108112

@@ -132,7 +136,8 @@ public void stepsOverTheSamePodsWaitTheTimeoutAtMostInAllWhileALimitedQueueDrain
132136
}
133137
final long elapsedMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
134138

135-
assertTrue(elapsedMillis < 2000 + 500, "waited " + elapsedMillis + " ms");
139+
// Under the 4.2 s the six reads take one after another, let alone a timeout per step.
140+
assertTrue(elapsedMillis < 2000 + 1500, "waited " + elapsedMillis + " ms");
136141
} finally {
137142
K8sMetadataReadSettings.set(2000, "", "als=21,mal=21", 3, 1);
138143
}

‎test/e2e-v2/cases/storage/banyandb/auth-rotation/e2e.yaml‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ verify:
5656
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service layer GENERAL
5757
expected: ../../expected/service.yml
5858

59+
# The consumer's calls are drawn to the provider, so the alias of the address it dials is stored
60+
# before the incomplete credentials can fail a write.
61+
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql dependency service --service-name=e2e-service-provider
62+
expected: ../../expected/dependency-services-provider.yml
63+
5964
# Create the file with the other identity the server accepts. Each retry rewrites the same
6065
# content, which the monitor compares and ignores, so only the first write is a change.
6166
#
@@ -85,12 +90,14 @@ verify:
8590
expected: expected/credentials-incomplete.yml
8691
8792
# Writing a complete pair back restores service without a restart. A different user than the
88-
# earlier rotation is used so the log line is distinguishable from it.
93+
# earlier rotation is used so the log line is distinguishable from it. The time the restore is
94+
# first seen applied is kept for the write check at the end.
8995
- query: |
9096
oap=$(docker ps -q --filter label=com.docker.compose.service=oap)
9197
docker exec $oap bash -c 'printf "user=admin\npassword=admin\n" > /tmp/bydb-secrets.properties'
9298
docker logs $oap 2>&1 \
9399
| grep -Fq "Applied the BanyanDB credentials reloaded from /tmp/bydb-secrets.properties, user=admin" \
100+
&& docker exec $oap bash -c '[ -e /tmp/restored-at ] || date +%s > /tmp/restored-at' \
94101
&& echo credentials-restored
95102
expected: expected/credentials-restored.yml
96103
@@ -99,6 +106,16 @@ verify:
99106
- includes:
100107
- ../../storage-cases.yaml
101108

109+
# The topology assertions above use the default range, the last 30 minutes, which rows written
110+
# before the rotation satisfy too. A minute bucket after the restore's holds only rows written on
111+
# the restored credentials, so the topology drawn from those minutes proves the writes resumed.
112+
# The minute is computed in the OAP container, so it is in the timezone the OAP reads it in.
113+
- query: |
114+
oap=$(docker ps -q --filter label=com.docker.compose.service=oap)
115+
start=$(docker exec $oap bash -c 'date -d @$(( $(cat /tmp/restored-at) + 60 )) "+%Y-%m-%d %H%M"') \
116+
&& swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql dependency service --service-name=e2e-service-provider --start "$start"
117+
expected: ../../expected/dependency-services-provider.yml
118+
102119
cleanup:
103120
on: always
104121
collect:

‎test/e2e-v2/cases/storage/banyandb/ca-rotation/e2e.yaml‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,31 @@ verify:
9797
expected: expected/server-rotated.yml
9898
9999
# Trust the new CA only. The rebuilt channel validates nothing but the new certificate, so the
100-
# storage assertions below run over a connection that needs both reloads to have happened.
100+
# storage assertions below run over a connection that needs both reloads to have happened. The
101+
# time the rebuild is first seen is kept for the write check after them.
101102
- query: |
102103
oap=$(docker ps -q --filter label=com.docker.compose.service=oap)
103104
docker exec $oap bash -c '[ -e /tmp/trust-new ] || { cp /tls-new/new-ca.crt /tmp/bydb-ca.next && mv /tmp/bydb-ca.next /tmp/bydb-ca.crt && touch /tmp/trust-new; }'
104105
[ "$(docker logs $oap 2>&1 | grep -Fc 'Rebuilt the BanyanDB channel')" -ge 3 ] \
106+
&& docker exec $oap bash -c '[ -e /tmp/trust-new-at ] || date +%s > /tmp/trust-new-at' \
105107
&& echo trust-new
106108
expected: expected/trust-new.yml
107109
108110
# Every storage assertion, over the channel that trusts the new CA only.
109111
- includes:
110112
- ../../storage-cases.yaml
111113

114+
# The topology assertions above use the default range, the last 30 minutes, which rows written
115+
# before the rotation satisfy too. A minute bucket after the rebuild's holds only rows written over
116+
# the channel that trusts the new CA only, so the topology drawn from those minutes proves the
117+
# writes went through it. The minute is computed in the OAP container, so it is in the timezone
118+
# the OAP reads it in.
119+
- query: |
120+
oap=$(docker ps -q --filter label=com.docker.compose.service=oap)
121+
start=$(docker exec $oap bash -c 'date -d @$(( $(cat /tmp/trust-new-at) + 60 )) "+%Y-%m-%d %H%M"') \
122+
&& swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql dependency service --service-name=e2e-service-provider --start "$start"
123+
expected: ../../expected/dependency-services-provider.yml
124+
112125
# Rotate the trust file to a CA unrelated to the server's certificate. The rebuilt channel then
113126
# trusts the wrong anchor, so the handshake fails PKIX validation -- which is what shows the
114127
# rotated material really reached the wire, and not merely that a log line was written.

0 commit comments

Comments
 (0)