use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class SimpleThemeTest method configure_simple_theme.
@Test
@ConfiguredWithReadme("simple-theme-plugin/README.md")
public void configure_simple_theme() {
// Already tested within the plugin itself, let's run some basic tests.
// https://github.com/jenkinsci/simple-theme-plugin/blob/master/src/test/java/org/jenkinsci/plugins/simpletheme/ConfigurationAsCodeTest.java
SimpleThemeDecorator decorator = ExtensionList.lookupSingleton(SimpleThemeDecorator.class);
assertNotNull(decorator);
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class SonarQubeTest method configure_sonar_globalconfig.
@Test
@ConfiguredWithReadme("sonarqube/README.md")
public void configure_sonar_globalconfig() {
final SonarGlobalConfiguration configuration = GlobalConfiguration.all().get(SonarGlobalConfiguration.class);
assertTrue(configuration.isBuildWrapperEnabled());
final SonarInstallation installation = configuration.getInstallations()[0];
assertEquals("TEST", installation.getName());
assertEquals("http://url:9000", installation.getServerUrl());
assertEquals("token", installation.getCredentialsId());
assertEquals("mojoVersion", installation.getMojoVersion());
assertEquals("additionalAnalysisProperties", installation.getAdditionalAnalysisProperties());
final TriggersConfig triggers = installation.getTriggers();
assertTrue(triggers.isSkipScmCause());
assertTrue(triggers.isSkipUpstreamCause());
assertEquals("envVar", triggers.getEnvVar());
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class ArtifactoryTest method configure_artifactory.
@Test
@ConfiguredWithReadme(value = "artifactory/README.md")
public void configure_artifactory() {
final Jenkins jenkins = Jenkins.get();
final ArtifactoryBuilder.DescriptorImpl descriptor = (ArtifactoryBuilder.DescriptorImpl) jenkins.getDescriptor(ArtifactoryBuilder.class);
assertTrue(descriptor.getUseCredentialsPlugin());
final List<JFrogPlatformInstance> jfrogInstances = descriptor.getJfrogInstances();
assertThat(jfrogInstances, hasSize(1));
assertThat(jfrogInstances.get(0).getId(), is(equalTo("artifactory")));
assertThat(jfrogInstances.get(0).getPlatformUrl(), is(equalTo("http://acme.com/artifactory")));
assertThat(jfrogInstances.get(0).getArtifactoryUrl(), is(equalTo("http://acme.com/artifactory")));
assertThat(jfrogInstances.get(0).getDistributionUrl(), is(equalTo("http://acme.com/distribution")));
assertThat(jfrogInstances.get(0).getDeployerCredentialsConfig().getCredentialsId(), is(equalTo("artifactory")));
assertThat(jfrogInstances.get(0).getResolverCredentialsConfig().getUsername(), is(equalTo("artifactory_user")));
assertThat(jfrogInstances.get(0).getResolverCredentialsConfig().getPassword().getPlainText(), is(equalTo("password123")));
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class CredentialsReadmeTest method testDomainScopedCredentials.
@Test
@ConfiguredWithReadme("credentials/README.md#0")
@Envs({ @Env(name = "SUDO_PASSWORD", value = "SUDO") })
public void testDomainScopedCredentials() {
List<StandardUsernamePasswordCredentials> creds = CredentialsProvider.lookupCredentials(StandardUsernamePasswordCredentials.class, Jenkins.getInstanceOrNull(), null, Collections.emptyList());
assertThat(creds.size(), is(1));
StandardUsernamePasswordCredentials cred = creds.get(0);
assertThat(cred.getId(), is("sudo_password"));
assertThat(cred.getUsername(), is("root"));
assertThat(cred.getPassword(), hasPlainText("SUDO"));
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class DockerCloudTest method configure_docker_cloud.
@Test
@ConfiguredWithReadme("docker/README.md")
public void configure_docker_cloud() {
final DockerCloud docker = DockerCloud.getCloudByName("docker");
assertNotNull(docker);
assertNotNull(docker.getDockerApi());
assertNotNull(docker.getDockerApi().getDockerHost());
assertEquals("unix:///var/run/docker.sock", docker.getDockerApi().getDockerHost().getUri());
final DockerTemplate template = docker.getTemplate("jenkins/agent");
checkTemplate(template, "docker-agent", "jenkins", "/home/jenkins/agent", "10", new String[] { "hello:/hello", "world:/world" }, "hello=world\nfoo=bar");
assertTrue(template.getRetentionStrategy() instanceof DockerOnceRetentionStrategy);
assertEquals(1, ((DockerOnceRetentionStrategy) template.getRetentionStrategy()).getIdleMinutes());
}
Aggregations