This is an automated email from the ASF dual-hosted git repository. JackieTien97 pushed a commit to branch codex/fix-it-default-credentials in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 2fd1c25b055cdb56c1ebadc521ecbfc5dedbeb5b Author: JackieTien97 <[email protected]> AuthorDate: Tue Oct 20 20:36:52 2026 +0800 Use default credentials in seed fallback IT and add IT guidelines --- integration-test/AGENTS.md | 87 ++++++++++++++++++++++ .../session/it/SessionSeedNodeFallbackIT.java | 4 +- 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/integration-test/AGENTS.md b/integration-test/AGENTS.md new file mode 100644 index 00000000000..64bc0d3b6eb --- /dev/null +++ b/integration-test/AGENTS.md @@ -0,0 +1,87 @@ +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> + +# Integration Test Guidelines + +These instructions apply to `integration-test/` and supplement the repository-level instructions. + +## Credentials and deployment defaults + +- Use `EnvFactory.getEnv()` connection helpers or client builders with their default credentials + when a test does not need a specific user. +- When constructing clients or helpers that require explicit default credentials, use + `SessionConfig.DEFAULT_USER` and `SessionConfig.DEFAULT_PASSWORD`. This includes + `NodesSupplier`, pools, and direct RPC helpers; do not hardcode `"root"` as the default password. + Default credentials can differ between IoTDB and downstream editions. +- Keep a client's business connections and discovery/recovery helpers on the same credentials. + Check helper methods as well as the main test body: a builder may use the correct defaults + while a manually constructed discovery client silently uses different ones. +- Explicit credentials are appropriate for users created by the test and for authentication or + invalid-password scenarios. Make that intent clear, and clean up users created by the test. +- Obtain node addresses and allocated ports from the test environment or node wrappers. Configure + required consensus protocols, replication factors, and other non-default settings before + initializing the cluster. + +## Asynchronous behavior and failure recovery + +- Use bounded condition waits, such as Awaitility or environment status helpers, for startup, + discovery, leader election, and recovery. Prefer observable conditions over fixed sleeps. +- Wait for each relevant layer separately. A node status reported by ConfigNode does not prove + that an existing client has refreshed its endpoint snapshot or recovered its connection. +- For locally stopped nodes, use `EnvUtils.getNodeStatusAfterLocalStop()` where applicable; + graceful process termination behaves differently on Unix and Windows. Use the appropriate + status expectation for forced termination. +- Keep connection/socket timeouts distinct from query timeouts and the overall assertion deadline. + Allow for startup and election costs on CI; use deliberately short timeouts only when needed by + the scenario. Do not retry non-idempotent setup statements just to hide a short timeout. +- For tests that require a stale discovery snapshot or a particular failover order, control + background refresh and assert the preconditions before triggering recovery. +- Investigate authentication, configuration, and transport failures before increasing a wait + timeout. A retained client snapshot can mean that discovery never succeeded. Include useful + endpoint/status context and preserve underlying failures when adding diagnostics. +- Do not label a failure as environmental or intermittent based only on one failed run. + +## Isolation and assertions + +- Follow the neighboring tests' runner, category, and environment lifecycle conventions. Select + the category matching the data model and topology required by the scenario. +- Close sessions, pools, and result sets; shut down test-owned executors and clean the cluster + even when assertions fail. Use try-with-resources and `finally` as appropriate. +- Assert the behavior under test and its recovery result. Only tolerate expected cleanup errors + in narrowly scoped cleanup code; do not swallow failures from the operation being verified. + +## Verification + +- Format Java changes with `mvn spotless:apply -pl integration-test -P with-integration-tests`. +- Run the affected IT classes or methods with the matching profile; do not run the entire IT + suite for a focused change. For a tree-model cluster test, run from the repository root: + + ```bash + mvn clean verify -DskipUTs \ + -Dit.test=ClassName#methodName \ + -DfailIfNoTests=false -Dfailsafe.failIfNoSpecifiedTests=false \ + -pl integration-test -am -PClusterIT -P with-integration-tests + ``` + +- Check the Failsafe report to confirm that the selected test actually ran; the no-tests flags + allow upstream reactor modules to have no matching tests. +- Report the tested revision, edition, profile, and result accurately. Passing an upstream build + does not establish that the corresponding downstream edition was tested. diff --git a/integration-test/src/test/java/org/apache/iotdb/session/it/SessionSeedNodeFallbackIT.java b/integration-test/src/test/java/org/apache/iotdb/session/it/SessionSeedNodeFallbackIT.java index a13fc8183b9..ceed96c3eb8 100644 --- a/integration-test/src/test/java/org/apache/iotdb/session/it/SessionSeedNodeFallbackIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/session/it/SessionSeedNodeFallbackIT.java @@ -196,8 +196,8 @@ public class SessionSeedNodeFallbackIT { return NodesSupplier.createNodeSupplier( seeds, executor, - "root", - "root", + SessionConfig.DEFAULT_USER, + SessionConfig.DEFAULT_PASSWORD, ZoneId.of("UTC"), SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY, SessionConfig.DEFAULT_MAX_FRAME_SIZE,
