use of com.thoughtworks.go.domain.ConfigErrors in project gocd by gocd.
the class ParamConfigTest method validate_shouldMakeSureParamNameIsOfNameType.
@Test
public void validate_shouldMakeSureParamNameIsOfNameType() {
assertThat(createAndValidate("name").errors().isEmpty(), is(true));
ConfigErrors errors = createAndValidate(".name").errors();
assertThat(errors.isEmpty(), is(false));
assertThat(errors.on(ParamConfig.NAME), is("Invalid parameter name '.name'. This must be alphanumeric and can contain underscores, hyphens and periods (however, it cannot start with a period). The maximum allowed length is 255 characters."));
}
use of com.thoughtworks.go.domain.ConfigErrors in project gocd by gocd.
the class JobConfigTest method shouldValidateAgainstSettingRunOnAllAgentsAndRunInstanceCountSetTogether.
@Test
void shouldValidateAgainstSettingRunOnAllAgentsAndRunInstanceCountSetTogether() {
JobConfig jobConfig = new JobConfig(new CaseInsensitiveString("test"));
jobConfig.setRunOnAllAgents(true);
jobConfig.setRunInstanceCount(10);
jobConfig.validate(ConfigSaveValidationContext.forChain(new BasicCruiseConfig()));
ConfigErrors configErrors = jobConfig.errors();
assertThat(configErrors.isEmpty()).isFalse();
assertThat(configErrors.on(JobConfig.RUN_TYPE)).isEqualTo("Job cannot be 'run on all agents' type and 'run multiple instance' type together.");
}
use of com.thoughtworks.go.domain.ConfigErrors in project gocd by gocd.
the class JobConfigTest method shouldValidateTheJobNameAgainstHaving_runInstance.
@Test
void shouldValidateTheJobNameAgainstHaving_runInstance() {
String jobName = "a-runInstance-1";
ConfigErrors configErrors = createJobAndValidate(jobName).errors();
assertThat(configErrors.isEmpty()).isFalse();
assertThat(configErrors.on(JobConfig.NAME)).isEqualTo(String.format("A job cannot have 'runInstance' in it's name: %s because it is a reserved keyword", jobName));
}
use of com.thoughtworks.go.domain.ConfigErrors in project gocd by gocd.
the class JobConfigTest method shouldValidateTheJobNameAgainstHaving_runOnAll.
@Test
void shouldValidateTheJobNameAgainstHaving_runOnAll() {
String jobName = "a-runOnAll-1";
ConfigErrors configErrors = createJobAndValidate(jobName).errors();
assertThat(configErrors.isEmpty()).isFalse();
assertThat(configErrors.on(JobConfig.NAME)).isEqualTo(String.format("A job cannot have 'runOnAll' in it's name: %s because it is a reserved keyword", jobName));
}
use of com.thoughtworks.go.domain.ConfigErrors in project gocd by gocd.
the class JobConfigTest method shouldValidateAgainstSettingRunOnAllAgentsForAJobAssignedToElasticAgent.
@Test
void shouldValidateAgainstSettingRunOnAllAgentsForAJobAssignedToElasticAgent() {
JobConfig jobConfig = new JobConfig(new CaseInsensitiveString("test"));
jobConfig.setRunOnAllAgents(true);
jobConfig.setElasticProfileId("ubuntu-dev");
jobConfig.validate(ConfigSaveValidationContext.forChain(new BasicCruiseConfig()));
ConfigErrors configErrors = jobConfig.errors();
assertThat(configErrors.isEmpty()).isFalse();
assertThat(configErrors.on(JobConfig.RUN_TYPE)).isEqualTo("Job cannot be set to 'run on all agents' when assigned to an elastic agent");
}
Aggregations