This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new b9f2dfa64 fix(instance): attribute a cloud-import audit to the
credential it read (#5979)
b9f2dfa64 is described below
commit b9f2dfa64b2f564f0d908ce1eedd1a7f92f2987e
Author: 烤化の初雪 <[email protected]>
AuthorDate: Fri Nov 27 12:14:08 2026 +0800
fix(instance): attribute a cloud-import audit to the credential it read
(#5979)
---
.../java/org/apache/rocketmq/studio/instance/InstanceService.java | 6 +++++-
.../org/apache/rocketmq/studio/instance/InstanceServiceTest.java | 8 ++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git
a/server/src/main/java/org/apache/rocketmq/studio/instance/InstanceService.java
b/server/src/main/java/org/apache/rocketmq/studio/instance/InstanceService.java
index 06256316a..1289a7918 100644
---
a/server/src/main/java/org/apache/rocketmq/studio/instance/InstanceService.java
+++
b/server/src/main/java/org/apache/rocketmq/studio/instance/InstanceService.java
@@ -398,7 +398,11 @@ public class InstanceService {
CloudImportAccumulator
result) {
log.info("Cloud import finished: vendor={}, credentialId={},
discovered={}, imported={}, skipped={}, failed={}",
vendor, credentialId, result.discovered, result.imported,
result.skipped, result.failedCount);
- recordAudit("IMPORT_CLOUD_INSTANCES", "INSTANCE",
String.valueOf(credentialId), null,
+ // The resource of an import is the credential it read, not an
instance: the timeline drawer
+ // looks rows up by (resourceType, resourceName), so "INSTANCE" + a
credential id attributed
+ // the operation to whichever instance happens to carry that id, while
the credential's own
+ // history - where an auditor looks for what was done with it - showed
nothing.
+ recordAudit("IMPORT_CLOUD_INSTANCES", "CLOUD_CREDENTIAL",
String.valueOf(credentialId), null,
"vendor=" + vendor + ", imported=" + result.imported + ",
skipped=" + result.skipped
+ ", failed=" + result.failedCount,
cloudImportAuditResult(result.imported, result.failedCount));
diff --git
a/server/src/test/java/org/apache/rocketmq/studio/instance/InstanceServiceTest.java
b/server/src/test/java/org/apache/rocketmq/studio/instance/InstanceServiceTest.java
index 8a2551979..053584d38 100644
---
a/server/src/test/java/org/apache/rocketmq/studio/instance/InstanceServiceTest.java
+++
b/server/src/test/java/org/apache/rocketmq/studio/instance/InstanceServiceTest.java
@@ -1716,7 +1716,9 @@ class InstanceServiceTest {
verify(catalog).listCloudInstances(1L, "cn-broken", null);
verify(catalog).listCloudInstances(1L, "cn-working", null);
verify(catalog).getCloudInstance(1L, "cn-working", "rmq-working");
- verify(operationAuditService).record(eq("IMPORT_CLOUD_INSTANCES"),
eq("INSTANCE"), eq("1"), eq(null),
+ // The audited resource is the credential the import read: the
timeline drawer looks rows up
+ // by (resourceType, resourceName), so "INSTANCE" + this id
misattributed the operation.
+ verify(operationAuditService).record(eq("IMPORT_CLOUD_INSTANCES"),
eq("CLOUD_CREDENTIAL"), eq("1"), eq(null),
argThat(detail -> detail.contains("imported=1") &&
detail.contains("failed=1")),
eq("PARTIAL"), eq(null));
}
@@ -1732,7 +1734,9 @@ class InstanceServiceTest {
assertThat(result.getFailedCount()).isEqualTo(1);
assertThat(result.getFailed()).containsExactly("regions: invalid
credential");
- verify(operationAuditService).record(eq("IMPORT_CLOUD_INSTANCES"),
eq("INSTANCE"), eq("1"), eq(null),
+ // The audited resource is the credential the import read: the
timeline drawer looks rows up
+ // by (resourceType, resourceName), so "INSTANCE" + this id
misattributed the operation.
+ verify(operationAuditService).record(eq("IMPORT_CLOUD_INSTANCES"),
eq("CLOUD_CREDENTIAL"), eq("1"), eq(null),
argThat(detail -> detail.contains("imported=0") &&
detail.contains("failed=1")),
eq("FAILED"), eq(null));
}