fix: failing tests on RemoteConsoleIT, RemoteGremlinIT, JsFunctionsTest#4346
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 20 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Code Review
This pull request updates JS and Gremlin tests to fix syntax and type assertions, and switches a HashMap to a LinkedHashMap in RemoteDatabase.java to preserve insertion order. Feedback has been provided regarding an extra leading space inside an assertThat call in RemoteGremlinFactoryIT.java and an optimization for initializing the LinkedHashMap capacity in RemoteDatabase.java to prevent unnecessary rehashing.
| // THIS IS IN THE SAME SCOPE, SO IT CAN SEE THE PENDING VERTICES ADDED EARLIER | ||
| try (final ResultSet list = graph.gremlin("g.V().hasLabel(\"inputstructure\").count()").execute()) { | ||
| assertThat((Integer) list.nextIfAvailable().getProperty("result")).isEqualTo(1_000); | ||
| assertThat( list.nextIfAvailable().<Long>getProperty("result")).isEqualTo(1_000); |
There was a problem hiding this comment.
There is an extra leading space inside the assertThat method call. According to the Google Java Style Guide, horizontal whitespace should not appear immediately after an opening parenthesis.
| assertThat( list.nextIfAvailable().<Long>getProperty("result")).isEqualTo(1_000); | |
| assertThat(list.nextIfAvailable().<Long>getProperty("result")).isEqualTo(1_000); |
References
- Google Java Style Guide: No whitespace should be added after the opening parenthesis of a method call. (link)
| final Map<String, Type> propTypes = parsePropertyTypes((String) map.get(Property.PROPERTY_TYPES_PROPERTY)); | ||
| if (!propTypes.isEmpty() || map.containsKey(Property.PROPERTY_TYPES_PROPERTY)) { | ||
| final Map<String, Object> converted = new HashMap<>(map.size()); | ||
| final Map<String, Object> converted = new LinkedHashMap<>(map.size()); |
There was a problem hiding this comment.
When initializing a LinkedHashMap with a known size, it is recommended to calculate the initial capacity taking the default load factor (0.75) into account to avoid unnecessary rehashing/resizing when the map is populated.
| final Map<String, Object> converted = new LinkedHashMap<>(map.size()); | |
| final Map<String, Object> converted = new LinkedHashMap<>((int) Math.ceil(map.size() / 0.75f)); |
…1 in /studio [skip ci] Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 5.1.4 to 6.0.1. Release notes *Sourced from [webpack-cli's releases](https://github.com/webpack/webpack-cli/releases).* > v6.0.1 > ------ > > [6.0.1](https://github.com/webpack/webpack-cli/compare/webpack-cli@6.0.0...webpack-cli@6.0.1) (2024-12-20) > ---------------------------------------------------------------------------------------------------------- > > ### Bug Fixes > > * update peer dependencies ([ArcadeData#4356](https://redirect.github.com/webpack/webpack-cli/issues/4356)) ([7a7e5d9](webpack/webpack-cli@7a7e5d9)) > > v6.0.0 > ------ > > [6.0.0](https://github.com/webpack/webpack-cli/compare/webpack-cli@5.1.4...webpack-cli@6.0.0) (2024-12-19) > ========================================================================================================== > > ### BREAKING CHANGES > > * the minimum required Node.js version is `18.12.0` > * removed `init`, `loader` and `plugin` commands in favor [`create-webpack-app`](https://github.com/webpack/webpack-cli/tree/master/packages/create-webpack-app) > * dropped support for `webpack-dev-server@v4` > * minimum supported webpack version is `5.82.0` > * The `--define-process-env-node-env` option was renamed to `--config-node-env` > > ### Bug Fixes > > * allow to require `webpack.config.js` in ESM format ([ArcadeData#4346](https://redirect.github.com/webpack/webpack-cli/issues/4346)) ([5106684](webpack/webpack-cli@5106684)) > * correct the minimum help output ([ArcadeData#4057](https://redirect.github.com/webpack/webpack-cli/issues/4057)) ([c727c4f](webpack/webpack-cli@c727c4f)) > * gracefully shutting down ([ArcadeData#4145](https://redirect.github.com/webpack/webpack-cli/issues/4145)) ([90720e2](webpack/webpack-cli@90720e2)) > * improve help output for possible values ([ArcadeData#4316](https://redirect.github.com/webpack/webpack-cli/issues/4316)) ([4cd5aef](webpack/webpack-cli@4cd5aef)) > * no serve when dev-server is false ([ArcadeData#2947](https://redirect.github.com/webpack/webpack-cli/issues/2947)) ([a93e860](webpack/webpack-cli@a93e860)) > > ### Features > > * output pnpm version with `info`/`version` command ([ArcadeData#3906](https://redirect.github.com/webpack/webpack-cli/issues/3906)) ([38f3c6f](webpack/webpack-cli@38f3c6f)) Changelog *Sourced from [webpack-cli's changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md).* > [6.0.1](https://github.com/webpack/webpack-cli/compare/webpack-cli@6.0.0...webpack-cli@6.0.1) (2024-12-20) > ---------------------------------------------------------------------------------------------------------- > > ### Bug Fixes > > * update peer dependencies ([ArcadeData#4356](https://redirect.github.com/webpack/webpack-cli/issues/4356)) ([7a7e5d9](webpack/webpack-cli@7a7e5d9)) > > [6.0.0](https://github.com/webpack/webpack-cli/compare/webpack-cli@5.1.4...webpack-cli@6.0.0) (2024-12-19) > ========================================================================================================== > > ### BREAKING CHANGES > > * the minimum required Node.js version is `18.12.0` > * removed `init`, `loader` and `plugin` commands in favor [`create-webpack-app`](https://github.com/webpack/webpack-cli/tree/master/packages/create-webpack-app) > * dropped support for `webpack-dev-server@v4` > * minimum supported webpack version is `5.82.0` > * The `--define-process-env-node-env` option was renamed to `--config-node-env` > > ### Bug Fixes > > * allow to require `webpack.config.js` in ESM format ([ArcadeData#4346](https://redirect.github.com/webpack/webpack-cli/issues/4346)) ([5106684](webpack/webpack-cli@5106684)) > * correct the minimum help output ([ArcadeData#4057](https://redirect.github.com/webpack/webpack-cli/issues/4057)) ([c727c4f](webpack/webpack-cli@c727c4f)) > * gracefully shutting down ([ArcadeData#4145](https://redirect.github.com/webpack/webpack-cli/issues/4145)) ([90720e2](webpack/webpack-cli@90720e2)) > * improve help output for possible values ([ArcadeData#4316](https://redirect.github.com/webpack/webpack-cli/issues/4316)) ([4cd5aef](webpack/webpack-cli@4cd5aef)) > * no serve when dev-server is false ([ArcadeData#2947](https://redirect.github.com/webpack/webpack-cli/issues/2947)) ([a93e860](webpack/webpack-cli@a93e860)) > > ### Features > > * output pnpm version with `info`/`version` command ([ArcadeData#3906](https://redirect.github.com/webpack/webpack-cli/issues/3906)) ([38f3c6f](webpack/webpack-cli@38f3c6f)) Commits * [`480b33d`](webpack/webpack-cli@480b33d) chore(release): publish new version * [`7a5071b`](webpack/webpack-cli@7a5071b) test: fix * [`8326501`](webpack/webpack-cli@8326501) fix: better default values * [`eab2f39`](webpack/webpack-cli@eab2f39) fix: less dependencies * [`2db1195`](webpack/webpack-cli@2db1195) refactor: code * [`fca8c00`](webpack/webpack-cli@fca8c00) fix: logging * [`09c7cd7`](webpack/webpack-cli@09c7cd7) fix: reduce package size, avoid `*.d.ts` * [`7a7e5d9`](webpack/webpack-cli@7a7e5d9) fix: update peer dependencies ([ArcadeData#4356](https://redirect.github.com/webpack/webpack-cli/issues/4356)) * [`5405aed`](webpack/webpack-cli@5405aed) chore(deps-dev): bump readable-stream in the dependencies group ([ArcadeData#4355](https://redirect.github.com/webpack/webpack-cli/issues/4355)) * [`270fdc2`](webpack/webpack-cli@270fdc2) chore(release): create-webpack-app * Additional commits viewable in [compare view](https://github.com/webpack/webpack-cli/compare/webpack-cli@5.1.4...webpack-cli@6.0.1) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) You can trigger a rebase of this PR by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) > \*\*Note\*\* > Automatic rebases have been disabled on this pull request as it has been open for over 30 days.
Summary
Fixes four failing tests on the current branch:
RemoteDatabase.json2Resultused aHashMapin the per-column type-hint branch added by Query count(*) return different field type depending on whether RemoteDatabase or RemoteGrpcDatabase is used. #4267, which silently reshuffled SELECT projection column order over the HTTP wire. Swap toLinkedHashMapto match the pre-Query count(*) return different field type depending on whether RemoteDatabase or RemoteGrpcDatabase is used. #4267 behavior ofresult.toMap()(which already returned aLinkedHashMapfromJSONObject.toMap()).IntegertoLongto match the now-correct numeric type returned by remote count queries (Query count(*) return different field type depending on whether RemoteDatabase or RemoteGrpcDatabase is used. #4267 follow-up).Test plan
mvn test -pl console -Dtest=RemoteConsoleIT- 16/16 passmvn test -pl server -Dtest='Issue4267CountTypeIT'- 2/2 pass (verifies the original Query count(*) return different field type depending on whether RemoteDatabase or RemoteGrpcDatabase is used. #4267 fix still works)