]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19425 Rename docker to container in telemetry and system info
authorAlain Kermis <alain.kermis@sonarsource.com>
Fri, 2 Jun 2023 07:10:05 +0000 (09:10 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 13 Jun 2023 20:03:39 +0000 (20:03 +0000)
16 files changed:
server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryData.java
server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryDataJsonWriter.java
server/sonar-server-common/src/test/java/org/sonar/server/telemetry/TelemetryDataJsonWriterTest.java
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ContainerSupport.java [new file with mode: 0644]
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ContainerSupportImpl.java [new file with mode: 0644]
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DockerSupport.java [deleted file]
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DockerSupportImpl.java [deleted file]
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/StandaloneSystemSection.java
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/GlobalSystemSection.java
server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java
server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ContainerSupportImplTest.java [new file with mode: 0644]
server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DockerSupportImplTest.java [deleted file]
server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/StandaloneSystemSectionTest.java
server/sonar-webserver-core/src/test/java/org/sonar/server/platform/monitoring/cluster/GlobalSystemSectionTest.java
server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java
server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java

index 44b65e3395c31fe274db48169c87fe6ed8bc26c7..2f980f50d575c45dcc6563371f681eef17fad14a 100644 (file)
@@ -44,7 +44,7 @@ public class TelemetryData {
   private final String defaultQualityGate;
   private final Long installationDate;
   private final String installationVersion;
-  private final boolean inDocker;
+  private final boolean inContainer;
   private final ManagedInstanceInformation managedInstanceInformation;
   private final CloudUsage cloudUsage;
   private final List<UserTelemetryDto> users;
@@ -68,7 +68,7 @@ public class TelemetryData {
     defaultQualityGate = builder.defaultQualityGate;
     installationDate = builder.installationDate;
     installationVersion = builder.installationVersion;
-    inDocker = builder.inDocker;
+    inContainer = builder.inContainer;
     users = builder.users;
     projects = builder.projects;
     projectStatistics = builder.projectStatistics;
@@ -119,8 +119,8 @@ public class TelemetryData {
     return installationVersion;
   }
 
-  public boolean isInDocker() {
-    return inDocker;
+  public boolean isInContainer() {
+    return inContainer;
   }
 
   public ManagedInstanceInformation getManagedInstanceInformation() {
@@ -185,7 +185,7 @@ public class TelemetryData {
     private String defaultQualityGate;
     private Long installationDate;
     private String installationVersion;
-    private boolean inDocker = false;
+    private boolean inContainer = false;
     private ManagedInstanceInformation managedInstanceInformation;
     private CloudUsage cloudUsage;
     private Boolean hasUnanalyzedC;
@@ -248,8 +248,8 @@ public class TelemetryData {
       return this;
     }
 
-    Builder setInDocker(boolean inDocker) {
-      this.inDocker = inDocker;
+    Builder setInContainer(boolean inContainer) {
+      this.inContainer = inContainer;
       return this;
     }
 
index 3712a810f10d258f9b5547e428de0cff28f24a2a..d5243c541f73873f7e2ddd1f53a62957aea986fc 100644 (file)
@@ -94,7 +94,7 @@ public class TelemetryDataJsonWriter {
     if (telemetryData.getInstallationVersion() != null) {
       json.prop("installationVersion", telemetryData.getInstallationVersion());
     }
-    json.prop("docker", telemetryData.isInDocker());
+    json.prop("container", telemetryData.isInContainer());
 
     writeUserData(json, telemetryData);
     writeProjectData(json, telemetryData);
index 30144e50ac42c05cc6d3eec252b5cf7c4bbafba8..dcec40331913b11ca6782a02c53566531a39b51d 100644 (file)
@@ -227,17 +227,17 @@ public class TelemetryDataJsonWriterTest {
 
   @Test
   @UseDataProvider("getFeatureFlagEnabledStates")
-  public void write_docker_flag(boolean isInDocker) {
+  public void write_container_flag(boolean isIncontainer) {
     TelemetryData data = telemetryBuilder()
-      .setInDocker(isInDocker)
+      .setInContainer(isIncontainer)
       .build();
 
     String json = writeTelemetryData(data);
     assertJson(json).isSimilarTo("""
       {
-        "docker": %s
+        "container": %s
       }
-      """.formatted(isInDocker));
+      """.formatted(isIncontainer));
   }
 
   @DataProvider
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ContainerSupport.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ContainerSupport.java
new file mode 100644 (file)
index 0000000..22a59f5
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.platform;
+
+public interface ContainerSupport {
+  /**
+   * @return {@code true} if we can detect that SQ is running inside a docker container
+   */
+  boolean isRunningInContainer();
+
+}
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ContainerSupportImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ContainerSupportImpl.java
new file mode 100644 (file)
index 0000000..38997c5
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.platform;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.stream.Stream;
+import org.sonar.server.util.Paths2;
+
+public class ContainerSupportImpl implements ContainerSupport {
+  private final Paths2 paths2;
+
+  public ContainerSupportImpl(Paths2 paths2) {
+    this.paths2 = paths2;
+  }
+
+  @Override
+  public boolean isRunningInContainer() {
+    if (paths2.exists("/run/.containerenv")) {
+      return true;
+    }
+    try (Stream<String> stream = Files.lines(paths2.get("/proc/1/cgroup"))) {
+      return stream.anyMatch(line -> line.contains("/docker") || line.contains("/kubepods") || line.contains("containerd.service") );
+    } catch (IOException e) {
+      return false;
+    }
+  }
+}
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DockerSupport.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DockerSupport.java
deleted file mode 100644 (file)
index 51dcc25..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.platform;
-
-public interface DockerSupport {
-  /**
-   * @return {@code true} if we can detect that SQ is running inside a docker container
-   */
-  boolean isRunningInDocker();
-
-}
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DockerSupportImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DockerSupportImpl.java
deleted file mode 100644 (file)
index 84dac73..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.platform;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.util.stream.Stream;
-import org.sonar.server.util.Paths2;
-
-public class DockerSupportImpl implements DockerSupport {
-  private final Paths2 paths2;
-
-  public DockerSupportImpl(Paths2 paths2) {
-    this.paths2 = paths2;
-  }
-
-  @Override
-  public boolean isRunningInDocker() {
-    if (paths2.exists("/run/.containerenv")) {
-      return true;
-    }
-    try (Stream<String> stream = Files.lines(paths2.get("/proc/1/cgroup"))) {
-      return stream.anyMatch(line -> line.contains("/docker") || line.contains("/kubepods") || line.contains("containerd.service") );
-    } catch (IOException e) {
-      return false;
-    }
-  }
-}
index c7f433985ef4bdb1da6c57d7564fb55d0d05539e..0502556fef5292107166c50fb5185c151973cc99 100644 (file)
@@ -25,7 +25,7 @@ import org.sonar.api.platform.Server;
 import org.sonar.process.systeminfo.BaseSectionMBean;
 import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
 import org.sonar.server.log.ServerLogging;
-import org.sonar.server.platform.DockerSupport;
+import org.sonar.server.platform.ContainerSupport;
 import org.sonar.server.platform.OfficialDistribution;
 import org.sonar.server.platform.StatisticsSupport;
 
@@ -42,19 +42,19 @@ public class StandaloneSystemSection extends BaseSectionMBean implements SystemS
   private final Server server;
   private final ServerLogging serverLogging;
   private final OfficialDistribution officialDistribution;
-  private final DockerSupport dockerSupport;
+  private final ContainerSupport containerSupport;
   private final StatisticsSupport statisticsSupport;
   private final SonarRuntime sonarRuntime;
   private final CommonSystemInformation commonSystemInformation;
 
   public StandaloneSystemSection(Configuration config, Server server, ServerLogging serverLogging,
-    OfficialDistribution officialDistribution, DockerSupport dockerSupport, StatisticsSupport statisticsSupport,
+    OfficialDistribution officialDistribution, ContainerSupport containerSupport, StatisticsSupport statisticsSupport,
     SonarRuntime sonarRuntime, CommonSystemInformation commonSystemInformation) {
     this.config = config;
     this.server = server;
     this.serverLogging = serverLogging;
     this.officialDistribution = officialDistribution;
-    this.dockerSupport = dockerSupport;
+    this.containerSupport = containerSupport;
     this.statisticsSupport = statisticsSupport;
     this.sonarRuntime = sonarRuntime;
     this.commonSystemInformation = commonSystemInformation;
@@ -90,7 +90,7 @@ public class StandaloneSystemSection extends BaseSectionMBean implements SystemS
     setAttribute(protobuf, "Version", getVersion());
     setAttribute(protobuf, "Edition", sonarRuntime.getEdition().getLabel());
     setAttribute(protobuf, NCLOC.getName(), statisticsSupport.getLinesOfCode());
-    setAttribute(protobuf, "Docker", dockerSupport.isRunningInDocker());
+    setAttribute(protobuf, "Container", containerSupport.isRunningInContainer());
     setAttribute(protobuf, "External Users and Groups Provisioning", commonSystemInformation.getManagedInstanceProviderName());
     setAttribute(protobuf, "External User Authentication", commonSystemInformation.getExternalUserAuthentication());
     addIfNotEmpty(protobuf, "Accepted external identity providers",
index 308b1733c1d40ea3b588a0bb54571b4b24e7d856..13fb551edc492f47418168dacaadc7f9f08a196f 100644 (file)
@@ -25,7 +25,7 @@ import org.sonar.api.server.ServerSide;
 import org.sonar.process.systeminfo.Global;
 import org.sonar.process.systeminfo.SystemInfoSection;
 import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
-import org.sonar.server.platform.DockerSupport;
+import org.sonar.server.platform.ContainerSupport;
 import org.sonar.server.platform.StatisticsSupport;
 import org.sonar.server.platform.monitoring.CommonSystemInformation;
 
@@ -37,15 +37,15 @@ import static org.sonar.process.systeminfo.SystemInfoUtils.setAttribute;
 public class GlobalSystemSection implements SystemInfoSection, Global {
 
   private final Server server;
-  private final DockerSupport dockerSupport;
+  private final ContainerSupport containerSupport;
   private final StatisticsSupport statisticsSupport;
   private final SonarRuntime sonarRuntime;
   private final CommonSystemInformation commonSystemInformation;
 
-  public GlobalSystemSection(Server server, DockerSupport dockerSupport, StatisticsSupport statisticsSupport, SonarRuntime sonarRuntime,
+  public GlobalSystemSection(Server server, ContainerSupport containerSupport, StatisticsSupport statisticsSupport, SonarRuntime sonarRuntime,
     CommonSystemInformation commonSystemInformation) {
     this.server = server;
-    this.dockerSupport = dockerSupport;
+    this.containerSupport = containerSupport;
     this.statisticsSupport = statisticsSupport;
     this.sonarRuntime = sonarRuntime;
     this.commonSystemInformation = commonSystemInformation;
@@ -59,7 +59,7 @@ public class GlobalSystemSection implements SystemInfoSection, Global {
     setAttribute(protobuf, "Server ID", server.getId());
     setAttribute(protobuf, "Edition", sonarRuntime.getEdition().getLabel());
     setAttribute(protobuf, NCLOC.getName() ,statisticsSupport.getLinesOfCode());
-    setAttribute(protobuf, "Docker", dockerSupport.isRunningInDocker());
+    setAttribute(protobuf, "Container", containerSupport.isRunningInContainer());
     setAttribute(protobuf, "High Availability", true);
     setAttribute(protobuf, "External Users and Groups Provisioning",
       commonSystemInformation.getManagedInstanceProviderName());
index 384286685ea3064ba11df0309629a75ef7f7968b..c5fe2bfe8f24565e6bdfef7518fc056381b4b866 100644 (file)
@@ -58,7 +58,7 @@ import org.sonar.db.newcodeperiod.NewCodePeriodDto;
 import org.sonar.db.qualitygate.ProjectQgateAssociationDto;
 import org.sonar.db.qualitygate.QualityGateDto;
 import org.sonar.server.management.ManagedInstanceService;
-import org.sonar.server.platform.DockerSupport;
+import org.sonar.server.platform.ContainerSupport;
 import org.sonar.server.property.InternalProperties;
 import org.sonar.server.qualitygate.QualityGateCaycChecker;
 import org.sonar.server.qualitygate.QualityGateFinder;
@@ -105,7 +105,7 @@ public class TelemetryDataLoaderImpl implements TelemetryDataLoader {
   private final PlatformEditionProvider editionProvider;
   private final Configuration configuration;
   private final InternalProperties internalProperties;
-  private final DockerSupport dockerSupport;
+  private final ContainerSupport containerSupport;
   private final QualityGateCaycChecker qualityGateCaycChecker;
   private final QualityGateFinder qualityGateFinder;
   private final ManagedInstanceService managedInstanceService;
@@ -118,7 +118,7 @@ public class TelemetryDataLoaderImpl implements TelemetryDataLoader {
   @Inject
   public TelemetryDataLoaderImpl(Server server, DbClient dbClient, PluginRepository pluginRepository,
     PlatformEditionProvider editionProvider, InternalProperties internalProperties, Configuration configuration,
-    DockerSupport dockerSupport, QualityGateCaycChecker qualityGateCaycChecker, QualityGateFinder qualityGateFinder,
+    ContainerSupport containerSupport, QualityGateCaycChecker qualityGateCaycChecker, QualityGateFinder qualityGateFinder,
     ManagedInstanceService managedInstanceService, CloudUsageDataProvider cloudUsageDataProvider) {
     this.server = server;
     this.dbClient = dbClient;
@@ -126,7 +126,7 @@ public class TelemetryDataLoaderImpl implements TelemetryDataLoader {
     this.editionProvider = editionProvider;
     this.internalProperties = internalProperties;
     this.configuration = configuration;
-    this.dockerSupport = dockerSupport;
+    this.containerSupport = containerSupport;
     this.qualityGateCaycChecker = qualityGateCaycChecker;
     this.qualityGateFinder = qualityGateFinder;
     this.managedInstanceService = managedInstanceService;
@@ -181,7 +181,7 @@ public class TelemetryDataLoaderImpl implements TelemetryDataLoader {
 
     return data
       .setInstallationVersion(installationVersionProperty.orElse(null))
-      .setInDocker(dockerSupport.isRunningInDocker())
+      .setInContainer(containerSupport.isRunningInContainer())
       .setManagedInstanceInformation(buildManagedInstanceInformation())
       .setCloudUsage(buildCloudUsage())
       .build();
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ContainerSupportImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ContainerSupportImplTest.java
new file mode 100644 (file)
index 0000000..7b3188a
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.platform;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import org.apache.commons.io.FileUtils;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.sonar.server.util.Paths2;
+
+import static java.lang.System.lineSeparator;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class ContainerSupportImplTest {
+  private static final String CGROUP_DIR = "/proc/1/cgroup";
+  private static final String PODMAN_FILE_PATH = "/run/.containerenv";
+
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  private Paths2 paths2 = mock(Paths2.class);
+  private ContainerSupportImpl underTest = new ContainerSupportImpl(paths2);
+
+  @Test
+  public void isInDocker_returns_false_if_cgroup_file_does_not_exist() throws IOException {
+    Path emptyFile = temporaryFolder.newFile().toPath();
+    Files.delete(emptyFile);
+    when(paths2.get(CGROUP_DIR)).thenReturn(emptyFile);
+
+    assertThat(underTest.isRunningInContainer()).isFalse();
+  }
+
+  @Test
+  public void isInDocker_returns_false_if_cgroup_file_is_empty() throws IOException {
+    Path emptyFile = temporaryFolder.newFile().toPath();
+    when(paths2.get(CGROUP_DIR)).thenReturn(emptyFile);
+
+    assertThat(underTest.isRunningInContainer()).isFalse();
+  }
+
+  @Test
+  public void isInDocker_returns_false_if_cgroup_dir_contains_no_file_with_slash_docker_string() throws IOException {
+    Path cgroupFile = temporaryFolder.newFile().toPath();
+    String content = "11:name=systemd:/" + lineSeparator() +
+      "10:hugetlb:/" + lineSeparator() +
+      "9:perf_event:/" + lineSeparator() +
+      "8:blkio:/" + lineSeparator() +
+      "7:freezer:/" + lineSeparator() +
+      "6:devices:/" + lineSeparator() +
+      "5:memory:/" + lineSeparator() +
+      "4:cpuacct:/" + lineSeparator() +
+      "3:cpu:/" + lineSeparator() +
+      "2:cpuset:/";
+    FileUtils.write(cgroupFile.toFile(), content, StandardCharsets.UTF_8);
+    when(paths2.get(CGROUP_DIR)).thenReturn(cgroupFile);
+
+    assertThat(underTest.isRunningInContainer()).isFalse();
+  }
+
+  @Test
+  public void isInDocker_returns_true_if_cgroup_dir_contains_file_with_slash_docker_string() throws IOException {
+    Path cgroupFile = temporaryFolder.newFile().toPath();
+    String content = "11:name=systemd:/" + lineSeparator() +
+      "10:hugetlb:/" + lineSeparator() +
+      "9:perf_event:/" + lineSeparator() +
+      "8:blkio:/" + lineSeparator() +
+      "7:freezer:/" + lineSeparator() +
+      "6:devices:/docker/3601745b3bd54d9780436faa5f0e4f72bb46231663bb99a6bb892764917832c2" + lineSeparator() +
+      "5:memory:/" + lineSeparator() +
+      "4:cpuacct:/" + lineSeparator() +
+      "3:cpu:/docker/3601745b3bd54d9780436faa5f0e4f72bb46231663bb99a6bb892764917832c2" + lineSeparator() +
+      "2:cpuset:/";
+    FileUtils.write(cgroupFile.toFile(), content, StandardCharsets.UTF_8);
+    when(paths2.get(CGROUP_DIR)).thenReturn(cgroupFile);
+
+    assertThat(underTest.isRunningInContainer()).isTrue();
+  }
+
+  @Test
+  public void isInDocker_returns_true_if_cgroup_dir_contains_file_with_kubepods_string() throws IOException {
+    Path cgroupFile = temporaryFolder.newFile().toPath();
+    String content = "11:blkio:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
+      "10:cpuset:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
+      "9:net_cls,net_prio:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
+      "8:pids:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
+      "7:perf_event:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
+      "6:freezer:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
+      "5:hugetlb:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
+      "4:memory:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
+      "3:devices:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
+      "2:cpu,cpuacct:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
+      "1:name=systemd:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366";
+    FileUtils.write(cgroupFile.toFile(), content, StandardCharsets.UTF_8);
+    when(paths2.get(CGROUP_DIR)).thenReturn(cgroupFile);
+
+    assertThat(underTest.isRunningInContainer()).isTrue();
+  }
+
+  @Test
+  public void isInDocker_returns_true_if_cgroup_dir_contains_file_with_containerd_string() throws IOException {
+    Path cgroupFile = temporaryFolder.newFile().toPath();
+    String content = "12:blkio:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "11:perf_event:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "10:hugetlb:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "9:pids:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "8:rdma:/" + lineSeparator() +
+      "7:memory:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "6:cpuset:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "5:net_cls,net_prio:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "4:freezer:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "3:cpu,cpuacct:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "2:devices:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "1:name=systemd:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
+      "0::/system.slice/containerd.service";
+    FileUtils.write(cgroupFile.toFile(), content, StandardCharsets.UTF_8);
+    when(paths2.get(CGROUP_DIR)).thenReturn(cgroupFile);
+
+    assertThat(underTest.isRunningInContainer()).isTrue();
+  }
+
+  @Test
+  public void isInDocker_returns_true_if_podman_file_exists() throws IOException {
+    when(paths2.exists(PODMAN_FILE_PATH)).thenReturn(true);
+    assertThat(underTest.isRunningInContainer()).isTrue();
+  }
+
+  @Test
+  public void isInDocker_returns_false_if_podman_file_exists() throws IOException {
+    when(paths2.exists(PODMAN_FILE_PATH)).thenReturn(false);
+    Path emptyFile = temporaryFolder.newFile().toPath();
+    when(paths2.get(CGROUP_DIR)).thenReturn(emptyFile);
+    assertThat(underTest.isRunningInContainer()).isFalse();
+  }
+
+}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DockerSupportImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DockerSupportImplTest.java
deleted file mode 100644 (file)
index c5e15fc..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.platform;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import org.apache.commons.io.FileUtils;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.sonar.server.util.Paths2;
-
-import static java.lang.System.lineSeparator;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class DockerSupportImplTest {
-  private static final String CGROUP_DIR = "/proc/1/cgroup";
-  private static final String PODMAN_FILE_PATH = "/run/.containerenv";
-
-  @Rule
-  public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
-  private Paths2 paths2 = mock(Paths2.class);
-  private DockerSupportImpl underTest = new DockerSupportImpl(paths2);
-
-  @Test
-  public void isInDocker_returns_false_if_cgroup_file_does_not_exist() throws IOException {
-    Path emptyFile = temporaryFolder.newFile().toPath();
-    Files.delete(emptyFile);
-    when(paths2.get(CGROUP_DIR)).thenReturn(emptyFile);
-
-    assertThat(underTest.isRunningInDocker()).isFalse();
-  }
-
-  @Test
-  public void isInDocker_returns_false_if_cgroup_file_is_empty() throws IOException {
-    Path emptyFile = temporaryFolder.newFile().toPath();
-    when(paths2.get(CGROUP_DIR)).thenReturn(emptyFile);
-
-    assertThat(underTest.isRunningInDocker()).isFalse();
-  }
-
-  @Test
-  public void isInDocker_returns_false_if_cgroup_dir_contains_no_file_with_slash_docker_string() throws IOException {
-    Path cgroupFile = temporaryFolder.newFile().toPath();
-    String content = "11:name=systemd:/" + lineSeparator() +
-      "10:hugetlb:/" + lineSeparator() +
-      "9:perf_event:/" + lineSeparator() +
-      "8:blkio:/" + lineSeparator() +
-      "7:freezer:/" + lineSeparator() +
-      "6:devices:/" + lineSeparator() +
-      "5:memory:/" + lineSeparator() +
-      "4:cpuacct:/" + lineSeparator() +
-      "3:cpu:/" + lineSeparator() +
-      "2:cpuset:/";
-    FileUtils.write(cgroupFile.toFile(), content, StandardCharsets.UTF_8);
-    when(paths2.get(CGROUP_DIR)).thenReturn(cgroupFile);
-
-    assertThat(underTest.isRunningInDocker()).isFalse();
-  }
-
-  @Test
-  public void isInDocker_returns_true_if_cgroup_dir_contains_file_with_slash_docker_string() throws IOException {
-    Path cgroupFile = temporaryFolder.newFile().toPath();
-    String content = "11:name=systemd:/" + lineSeparator() +
-      "10:hugetlb:/" + lineSeparator() +
-      "9:perf_event:/" + lineSeparator() +
-      "8:blkio:/" + lineSeparator() +
-      "7:freezer:/" + lineSeparator() +
-      "6:devices:/docker/3601745b3bd54d9780436faa5f0e4f72bb46231663bb99a6bb892764917832c2" + lineSeparator() +
-      "5:memory:/" + lineSeparator() +
-      "4:cpuacct:/" + lineSeparator() +
-      "3:cpu:/docker/3601745b3bd54d9780436faa5f0e4f72bb46231663bb99a6bb892764917832c2" + lineSeparator() +
-      "2:cpuset:/";
-    FileUtils.write(cgroupFile.toFile(), content, StandardCharsets.UTF_8);
-    when(paths2.get(CGROUP_DIR)).thenReturn(cgroupFile);
-
-    assertThat(underTest.isRunningInDocker()).isTrue();
-  }
-
-  @Test
-  public void isInDocker_returns_true_if_cgroup_dir_contains_file_with_kubepods_string() throws IOException {
-    Path cgroupFile = temporaryFolder.newFile().toPath();
-    String content = "11:blkio:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
-      "10:cpuset:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
-      "9:net_cls,net_prio:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
-      "8:pids:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
-      "7:perf_event:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
-      "6:freezer:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
-      "5:hugetlb:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
-      "4:memory:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
-      "3:devices:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
-      "2:cpu,cpuacct:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366" + lineSeparator() +
-      "1:name=systemd:/kubepods/burstable/pod8e9a7fc0-4e11-4497-a424-19b9713eff0e/8953402928cc7fc95c7dc7bdb75b194139fe29e8fa196d7f90924deb29164366";
-    FileUtils.write(cgroupFile.toFile(), content, StandardCharsets.UTF_8);
-    when(paths2.get(CGROUP_DIR)).thenReturn(cgroupFile);
-
-    assertThat(underTest.isRunningInDocker()).isTrue();
-  }
-
-  @Test
-  public void isInDocker_returns_true_if_cgroup_dir_contains_file_with_containerd_string() throws IOException {
-    Path cgroupFile = temporaryFolder.newFile().toPath();
-    String content = "12:blkio:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "11:perf_event:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "10:hugetlb:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "9:pids:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "8:rdma:/" + lineSeparator() +
-      "7:memory:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "6:cpuset:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "5:net_cls,net_prio:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "4:freezer:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "3:cpu,cpuacct:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "2:devices:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "1:name=systemd:/default/846fe494c3021f068c9156ca6eb8a91038389b7e2a2b1ae9b050b33c3a5c9298" + lineSeparator() +
-      "0::/system.slice/containerd.service";
-    FileUtils.write(cgroupFile.toFile(), content, StandardCharsets.UTF_8);
-    when(paths2.get(CGROUP_DIR)).thenReturn(cgroupFile);
-
-    assertThat(underTest.isRunningInDocker()).isTrue();
-  }
-
-  @Test
-  public void isInDocker_returns_true_if_podman_file_exists() throws IOException {
-    when(paths2.exists(PODMAN_FILE_PATH)).thenReturn(true);
-    assertThat(underTest.isRunningInDocker()).isTrue();
-  }
-
-  @Test
-  public void isInDocker_returns_false_if_podman_file_exists() throws IOException {
-    when(paths2.exists(PODMAN_FILE_PATH)).thenReturn(false);
-    Path emptyFile = temporaryFolder.newFile().toPath();
-    when(paths2.get(CGROUP_DIR)).thenReturn(emptyFile);
-    assertThat(underTest.isRunningInDocker()).isFalse();
-  }
-
-}
index 25b06a0dcbf089ba5ae3337e28e7d3ed0398b744..6b63912df9caf0071b77b7b3dfa7e4479b01280a 100644 (file)
@@ -34,7 +34,7 @@ import org.sonar.api.platform.Server;
 import org.sonar.api.utils.log.LoggerLevel;
 import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
 import org.sonar.server.log.ServerLogging;
-import org.sonar.server.platform.DockerSupport;
+import org.sonar.server.platform.ContainerSupport;
 import org.sonar.server.platform.OfficialDistribution;
 import org.sonar.server.platform.StatisticsSupport;
 
@@ -58,13 +58,13 @@ public class StandaloneSystemSectionTest {
   private final Server server = mock(Server.class);
   private final ServerLogging serverLogging = mock(ServerLogging.class);
   private final OfficialDistribution officialDistribution = mock(OfficialDistribution.class);
-  private final DockerSupport dockerSupport = mock(DockerSupport.class);
+  private final ContainerSupport containerSupport = mock(ContainerSupport.class);
   private final StatisticsSupport statisticsSupport = mock(StatisticsSupport.class);
   private final SonarRuntime sonarRuntime = mock(SonarRuntime.class);
   private final CommonSystemInformation commonSystemInformation = mock(CommonSystemInformation.class);
 
   private final StandaloneSystemSection underTest = new StandaloneSystemSection(config, server, serverLogging,
-    officialDistribution, dockerSupport, statisticsSupport, sonarRuntime, commonSystemInformation);
+    officialDistribution, containerSupport, statisticsSupport, sonarRuntime, commonSystemInformation);
 
   @Before
   public void setUp() {
@@ -168,10 +168,10 @@ public class StandaloneSystemSectionTest {
 
   @Test
   @UseDataProvider("trueOrFalse")
-  public void return_docker_flag_from_DockerSupport(boolean flag) {
-    when(dockerSupport.isRunningInDocker()).thenReturn(flag);
+  public void toProtobuf_whenRunningOrNotRunningInContainer_shouldReturnCorrectFlag(boolean flag) {
+    when(containerSupport.isRunningInContainer()).thenReturn(flag);
     ProtobufSystemInfo.Section protobuf = underTest.toProtobuf();
-    assertThat(attribute(protobuf, "Docker").getBooleanValue()).isEqualTo(flag);
+    assertThat(attribute(protobuf, "Container").getBooleanValue()).isEqualTo(flag);
   }
 
   @Test
index 95711e233602761d2119fdfa100c63e4e0a07fce..83e30a01fd33f25ee3553d6f78b1b0d0a34ac159 100644 (file)
@@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
 import org.sonar.api.SonarRuntime;
 import org.sonar.api.platform.Server;
 import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
-import org.sonar.server.platform.DockerSupport;
+import org.sonar.server.platform.ContainerSupport;
 import org.sonar.server.platform.StatisticsSupport;
 import org.sonar.server.platform.monitoring.CommonSystemInformation;
 
@@ -45,12 +45,12 @@ import static org.sonar.server.platform.monitoring.SystemInfoTesting.assertThatA
 public class GlobalSystemSectionTest {
 
   private final Server server = mock(Server.class);
-  private final DockerSupport dockerSupport = mock(DockerSupport.class);
+  private final ContainerSupport containerSupport = mock(ContainerSupport.class);
   private final StatisticsSupport statisticsSupport = mock(StatisticsSupport.class);
   private final SonarRuntime sonarRuntime = mock(SonarRuntime.class);
   private final CommonSystemInformation commonSystemInformation = mock(CommonSystemInformation.class);
 
-  private final GlobalSystemSection underTest = new GlobalSystemSection(server, dockerSupport, statisticsSupport, sonarRuntime, commonSystemInformation);
+  private final GlobalSystemSection underTest = new GlobalSystemSection(server, containerSupport, statisticsSupport, sonarRuntime, commonSystemInformation);
 
   @Before
   public void setUp() {
@@ -141,11 +141,11 @@ public class GlobalSystemSectionTest {
 
   @Test
   @UseDataProvider("trueOrFalse")
-  public void get_docker_flag(boolean flag) {
-    when(dockerSupport.isRunningInDocker()).thenReturn(flag);
+  public void toProtobuf_whenRunningOrNotRunningInContainer_shouldReturnCorrectFlag(boolean flag) {
+    when(containerSupport.isRunningInContainer()).thenReturn(flag);
 
     ProtobufSystemInfo.Section protobuf = underTest.toProtobuf();
-    assertThatAttributeIs(protobuf, "Docker", flag);
+    assertThatAttributeIs(protobuf, "Container", flag);
   }
 
   @Test
index 40aa17d9dcf145e3214864798b3a109c990fa711..2ffedd16707374097dea006fee0054038ed69384 100644 (file)
@@ -57,7 +57,7 @@ import org.sonar.db.user.UserDbTester;
 import org.sonar.db.user.UserDto;
 import org.sonar.db.user.UserTelemetryDto;
 import org.sonar.server.management.ManagedInstanceService;
-import org.sonar.server.platform.DockerSupport;
+import org.sonar.server.platform.ContainerSupport;
 import org.sonar.server.property.InternalProperties;
 import org.sonar.server.property.MapInternalProperties;
 import org.sonar.server.qualitygate.QualityGateCaycChecker;
@@ -108,7 +108,7 @@ public class TelemetryDataLoaderImplTest {
   private final PluginRepository pluginRepository = mock(PluginRepository.class);
   private final Configuration configuration = mock(Configuration.class);
   private final PlatformEditionProvider editionProvider = mock(PlatformEditionProvider.class);
-  private final DockerSupport dockerSupport = mock(DockerSupport.class);
+  private final ContainerSupport containerSupport = mock(ContainerSupport.class);
   private final QualityGateCaycChecker qualityGateCaycChecker = mock(QualityGateCaycChecker.class);
   private final QualityGateFinder qualityGateFinder = new QualityGateFinder(db.getDbClient());
   private final InternalProperties internalProperties = spy(new MapInternalProperties());
@@ -116,9 +116,9 @@ public class TelemetryDataLoaderImplTest {
   private final CloudUsageDataProvider cloudUsageDataProvider = mock(CloudUsageDataProvider.class);
 
   private final TelemetryDataLoader communityUnderTest = new TelemetryDataLoaderImpl(server, db.getDbClient(), pluginRepository, editionProvider,
-    internalProperties, configuration, dockerSupport, qualityGateCaycChecker, qualityGateFinder, managedInstanceService, cloudUsageDataProvider);
+    internalProperties, configuration, containerSupport, qualityGateCaycChecker, qualityGateFinder, managedInstanceService, cloudUsageDataProvider);
   private final TelemetryDataLoader commercialUnderTest = new TelemetryDataLoaderImpl(server, db.getDbClient(), pluginRepository, editionProvider,
-    internalProperties, configuration, dockerSupport, qualityGateCaycChecker, qualityGateFinder, managedInstanceService, cloudUsageDataProvider);
+    internalProperties, configuration, containerSupport, qualityGateCaycChecker, qualityGateFinder, managedInstanceService, cloudUsageDataProvider);
 
   private QualityGateDto builtInDefaultQualityGate;
   private MetricDto bugsDto;
@@ -228,7 +228,7 @@ public class TelemetryDataLoaderImplTest {
     assertDatabaseMetadata(data.getDatabase());
     assertThat(data.getPlugins()).containsOnly(
       entry("java", "4.12.0.11033"), entry("scmgit", "1.2"), entry("other", "undefined"));
-    assertThat(data.isInDocker()).isFalse();
+    assertThat(data.isInContainer()).isFalse();
 
     assertThat(data.getUserTelemetries())
       .extracting(UserTelemetryDto::getUuid, UserTelemetryDto::getLastConnectionDate, UserTelemetryDto::getLastSonarlintConnectionDate, UserTelemetryDto::isActive)
index cfeb6a998b6f630e1b0562f143bab6d9a7f209d2..99dad1a58d37745a6fc1b029e0fcc19da23e56de 100644 (file)
@@ -52,7 +52,7 @@ import org.sonar.server.issue.index.IssueIndex;
 import org.sonar.server.issue.index.IssueIndexSyncProgressChecker;
 import org.sonar.server.permission.index.WebAuthorizationTypeSupport;
 import org.sonar.server.platform.DefaultNodeInformation;
-import org.sonar.server.platform.DockerSupportImpl;
+import org.sonar.server.platform.ContainerSupportImpl;
 import org.sonar.server.platform.LogServerVersion;
 import org.sonar.server.platform.Platform;
 import org.sonar.server.platform.ServerFileSystemImpl;
@@ -115,7 +115,7 @@ public class PlatformLevel1 extends PlatformLevel {
       new TempFolderProvider(),
       System2.INSTANCE,
       Paths2Impl.getInstance(),
-      DockerSupportImpl.class,
+      ContainerSupportImpl.class,
       Clock.systemDefaultZone(),
 
       // user session