Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,12 @@ private Document handleHostInfo() {
response.append("system", new Document()
.append("currentTime", Instant.now())
.append("hostname", Utils.getHostName())
.append("cpuArch", System.getProperty("os.arch"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets extend AbstractBackendTest#testHostInfo like this:

     @Test
     void testHostInfo() {
         Document result = runCommand("hostInfo");
         assertThat(result.get("ok")).isEqualTo(1.0);
         assertThat(result).containsKeys("os", "system", "extra");
+        assertThat(result.get("system", Document.class)).containsKeys("currentTime", "hostname", "cpuArch");
     }

);
response.append("extra", new Document()
.append("versionString", osName + " " + osVersion)
.append("kernelVersion", osVersion));
.append("kernelVersion", osVersion)
.append("physicalCores", Runtime.getRuntime().availableProcessors()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the behavior of an official MongoDB server?

I cannot find it in the docs: https://www.mongodb.com/docs/manual/reference/method/db.hostInfo/

Utils.markOkay(response);
return response;
}
Expand Down