Frun1na opened a new pull request, #6143:
URL: https://github.com/apache/rocketmq-dashboard/pull/6143
### Which Issue(s) This PR Fixes
- Fixes #6142
### Brief Description
Exported timestamps are zone-less server-local values, and only the audit
export said so: its column is named
`timestamp(UTC+08:00)` (`AuditService.csvHeader`) because the column name is
what makes the file interpretable
without out-of-band timezone knowledge. The topic and consumer-group exports
wrote the same kind of value under
plain `Created At` / `Updated At` headers, so their CSVs could not be
interpreted outside the server's zone.
`CsvUtil` now owns the label (`serverZoneLabel`) and the column header built
from it (`timestampColumn`); the
topic and consumer-group exports label both timestamp columns with it, and
`AuditService` uses the same helper
instead of its private copy, so the formula exists once. The stored values
are deliberately left unconverted, as
the audit export's javadoc explains.
User-visible change: the two exports' timestamp columns are now named e.g.
`Created At(UTC+08:00)` (`(UTC)` on a
UTC server); the values themselves are unchanged. `buildTopicCsv`'s header
row is also reworked by #6101 — this
change only adds the zone to the two timestamp labels.
### How Did You Test This Change?
```
cd server && mvn -B -ntp test -DforkCount=1
-Dsurefire.failIfNoSpecifiedTests=false \
-Dtest=CsvUtilTest,MetadataServiceTest,AuditServiceTest
[INFO] --- checkstyle:3.6.0:check (validate) @ rocketmq-studio ---
[INFO] Tests run: 83, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS
```
The cases that pin the label fail without it. Dropping the offset part from
the helper's formula reddens all
four of them, including the pre-existing audit export case:
```
[ERROR] Tests run: 83, Failures: 4, Errors: 0, Skipped: 0
CsvUtilTest.timestampColumnShouldNameTheZoneOfTheZoneLessValuesTest -- <<<
FAILURE!
expected: "Created At(UTC+08:00)"
but was: "Created At(UTC)"
MetadataServiceTest.exportTopicsShouldLabelTheTimestampColumnsWithTheServerZoneTest
-- <<< FAILURE!
MetadataServiceTest.exportConsumerGroupsShouldLabelTheTimestampColumnsWithTheServerZoneTest
-- <<< FAILURE!
AuditServiceTest.exportLogsLabelsTimestampColumnWithServerZoneOffset -- <<<
FAILURE!
```
The new assertions derive the expected offset from the zone the export ran
in (both tests run the export under
`Asia/Shanghai` and `UTC`, like the existing audit case), so they do not
depend on the machine's own zone.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
- [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [ ] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs` /
in-app help)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]