Search in sources :

Example 6 with DistroXTestDto

use of com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto in project cloudbreak by hortonworks.

the class TagsUtilTest method verifyTagsShouldFailTestContextHasNullAsActingCrn.

@Test
void verifyTagsShouldFailTestContextHasNullAsActingCrn() {
    DistroXTestDto testDto = new DistroXTestDto(mock(TestContext.class));
    StackV4Response response = new StackV4Response();
    TagsV4Response tags = new TagsV4Response();
    tags.setUserDefined(Map.of(TagsUtil.TEST_NAME_TAG, TEST_NAME));
    tags.setDefaults(DEFAULT_TAGS);
    response.setTags(tags);
    testDto.setResponse(response);
    when(testContext.getActingUserCrn()).thenReturn(null);
    String expectedMsg = String.format("[%s] tag validation is not possible, because of either the tag value [%s] or acting user Crn [%s]" + " is empty or null!", CLOUDERA_CREATOR_RESOURCE_NAME_TAG_KEY, ACTING_USER_CRN, "null");
    assertThatThrownBy(() -> underTest.verifyTags(testDto, testContext)).hasMessageContaining(expectedMsg).matches(e -> !e.getMessage().contains(TagsUtil.MISSING_TEST_NAME_TAG_MESSAGE));
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) TagsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.tags.TagsV4Response) Test(org.testng.annotations.Test)

Example 7 with DistroXTestDto

use of com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto in project cloudbreak by hortonworks.

the class TagsUtilTest method verifyTagsShouldFailAbstractTestDtoDoesNotHaveAnyNeededTags.

@Test
void verifyTagsShouldFailAbstractTestDtoDoesNotHaveAnyNeededTags() {
    DistroXTestDto testDto = new DistroXTestDto(mock(TestContext.class));
    testDto.setResponse(new StackV4Response());
    String expectedMessage = String.format(TagsUtil.TAG_VALUE_IS_NULL_FAILURE_PATTERN, TagsUtil.TEST_NAME_TAG);
    assertThatThrownBy(() -> underTest.verifyTags(testDto, testContext)).hasMessageContaining(expectedMessage);
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.testng.annotations.Test)

Example 8 with DistroXTestDto

use of com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto in project cloudbreak by hortonworks.

the class TagsUtilTest method verifyTagsShouldVerifyTagToAbstractTestDtoWithTaggedResponse.

@Test
void verifyTagsShouldVerifyTagToAbstractTestDtoWithTaggedResponse() {
    DistroXTestDto testDto = new DistroXTestDto(mock(TestContext.class));
    StackV4Response response = new StackV4Response();
    TagsV4Response tags = new TagsV4Response();
    tags.setUserDefined(Map.of(TagsUtil.TEST_NAME_TAG, TEST_NAME));
    tags.setDefaults(DEFAULT_TAGS);
    response.setTags(tags);
    testDto.setResponse(response);
    when(gcpLabelUtil.transformLabelKeyOrValue(anyString())).thenReturn(CLOUDERA_CREATOR_RESOURCE_NAME_TAG_KEY);
    assertThatCode(() -> underTest.verifyTags(testDto, testContext)).doesNotThrowAnyException();
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) TagsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.tags.TagsV4Response) Test(org.testng.annotations.Test)

Example 9 with DistroXTestDto

use of com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto in project cloudbreak by hortonworks.

the class TagsUtilTest method verifyCreatorWithAltusCrnButTestContextHasCdpCrn.

@Test
void verifyCreatorWithAltusCrnButTestContextHasCdpCrn() {
    DistroXTestDto testDto = new DistroXTestDto(mock(TestContext.class));
    StackV4Response response = new StackV4Response();
    TagsV4Response tags = new TagsV4Response();
    tags.setUserDefined(Map.of(TagsUtil.TEST_NAME_TAG, TEST_NAME));
    Map<String, String> defaultTags = new HashMap<>(DEFAULT_TAGS);
    defaultTags.put(CLOUDERA_CREATOR_RESOURCE_NAME_TAG_KEY, "crn:altus:iam:us-west-1:qe-gcp:user:cloudbreak-qe@hortonworks.com");
    tags.setDefaults(defaultTags);
    response.setTags(tags);
    testDto.setResponse(response);
    when(gcpLabelUtil.transformLabelKeyOrValue(anyString())).thenReturn(CLOUDERA_CREATOR_RESOURCE_NAME_TAG_KEY);
    assertThatCode(() -> underTest.verifyTags(testDto, testContext)).doesNotThrowAnyException();
}
Also used : StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) HashMap(java.util.HashMap) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) TagsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.tags.TagsV4Response) Test(org.testng.annotations.Test)

Example 10 with DistroXTestDto

use of com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto in project cloudbreak by hortonworks.

the class DistroXDiagnosticsTestDto method withDistroX.

public DistroXDiagnosticsTestDto withDistroX(String distroX) {
    DistroXTestDto distroXTestDto = distroX == null ? getTestContext().given(DistroXTestDto.class) : getTestContext().given(distroX, DistroXTestDto.class);
    getRequest().setStackCrn(distroXTestDto.getResponse().getCrn());
    return this;
}
Also used : DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)

Aggregations

DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)16 Test (org.testng.annotations.Test)11 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)7 MockedTestContext (com.sequenceiq.it.cloudbreak.context.MockedTestContext)7 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)7 TagsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.tags.TagsV4Response)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 Description (com.sequenceiq.it.cloudbreak.context.Description)4 HashMap (java.util.HashMap)3 DistroXClusterTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto)2 DistroXImageTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto)2 SdxTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto)2 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)2 Log (com.sequenceiq.it.cloudbreak.log.Log)2 AbstractClouderaManagerTest (com.sequenceiq.it.cloudbreak.testcase.mock.clouderamanager.AbstractClouderaManagerTest)2 String.format (java.lang.String.format)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2