Skip to content

Commit

Permalink
Don't run Kubernetes manifest generation in tests
Browse files Browse the repository at this point in the history
In tests, various Build Items are population with the
proper values (like the output target), so it's best
to not run the Kubernetes manifest generation at all
in order to avoid getting NPEs

Fixes: quarkusio#15555
  • Loading branch information
geoand committed Mar 9, 2021
1 parent ee25c48 commit cb6fff4
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.dekorate.utils.Strings;
import io.quarkus.deployment.Capabilities;
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.IsTest;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ApplicationInfoBuildItem;
Expand Down Expand Up @@ -75,7 +76,7 @@ public EnabledKubernetesDeploymentTargetsBuildItem enabledKubernetesDeploymentTa
return new EnabledKubernetesDeploymentTargetsBuildItem(entries);
}

@BuildStep
@BuildStep(onlyIfNot = IsTest.class)
public void build(ApplicationInfoBuildItem applicationInfo,
OutputTargetBuildItem outputTarget,
PackageConfig packageConfig,
Expand All @@ -92,9 +93,6 @@ public void build(ApplicationInfoBuildItem applicationInfo,

List<ConfiguratorBuildItem> allConfigurators = new ArrayList<>(configurators);
List<DecoratorBuildItem> allDecorators = new ArrayList<>(decorators);
if (launchMode.getLaunchMode() == LaunchMode.TEST) {
return;
}

if (kubernetesPorts.isEmpty()) {
log.debug("The service is not an HTTP service so no Kubernetes manifests will be generated");
Expand Down

0 comments on commit cb6fff4

Please sign in to comment.