Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[1LP][RFR] - Removing duplicate tc #9966

Conversation

dgaikwad
Copy link
Contributor

@dgaikwad dgaikwad commented Mar 4, 2020

  • Adding new test to check is email sent showing in-progress state or not after ordering the catalog

Purpose or Intent

PRT Run

@dgaikwad dgaikwad force-pushed the test_service_catalog_email_request_approval_pending branch from a025231 to 56328f8 Compare March 12, 2020 13:22
@dgaikwad dgaikwad changed the title [WIPTEST] - Test to check email pending status [RFR] - Test to check email pending status Mar 12, 2020
@john-dupuy john-dupuy added the test-automation To be applied on PR's which are automating existing manual cases label Mar 12, 2020
@dgaikwad dgaikwad changed the title [RFR] - Test to check email pending status [WIPTEST] - Test to check email pending status Mar 13, 2020
@dgaikwad dgaikwad force-pushed the test_service_catalog_email_request_approval_pending branch from 56328f8 to f236435 Compare March 13, 2020 04:15
@dgaikwad dgaikwad changed the title [WIPTEST] - Test to check email pending status [RFR] - Test to check email pending status Mar 13, 2020
Copy link
Contributor

@valaparthvi valaparthvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is collected twice, once for RHEV provider and once for VMWare provider. I think testing it against a single provider will be enough. And this will also resolve your need to delete the service request for a successful test execution if that is the reason why you're deleting the service request.



@pytest.mark.tier(2)
@pytest.mark.meta(coverage=[1380197])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use automates instead of coverage.

Comment on lines 283 to 291
# Remove Request
request_description = "Provisioning Service [{name}] from [{name}]".format(
name=generic_catalog_item.name
)
service_request = appliance.collections.requests.instantiate(
description=request_description, partial_check=True
)

request.addfinalizer(lambda: service_request.remove_request(method="rest"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the need to delete this service request, but if you must do it, you can directly put this inside a finalize block(outside the with block) like this -

@request.addfinalizer
def _finalize():
            # Remove Request
        request_description = "Provisioning Service [{name}] from [{name}]".format(
            name=generic_catalog_item.name
        )
        service_request = appliance.collections.requests.instantiate(
            description=request_description, partial_check=True
        )
       service_request.remove_request(method="rest")

Test to check is there have pending email approval status or not in log file after
ordering service catalog
Bugzilla:
1380197
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix indentation here?

service_request = service_catalogs.order(wait_for_view=30)

# Remove Request
request_description = "Provisioning Service [{name}] from [{name}]".format(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use f-string instead of format.

@valaparthvi valaparthvi changed the title [RFR] - Test to check email pending status [WIPTEST] - Test to check email pending status Mar 13, 2020
@dgaikwad dgaikwad force-pushed the test_service_catalog_email_request_approval_pending branch 2 times, most recently from 54f4974 to 7e4d654 Compare March 13, 2020 09:42
@dgaikwad dgaikwad changed the title [WIPTEST] - Test to check email pending status [RFR] - Test to check email pending status Mar 13, 2020
Copy link
Contributor

@valaparthvi valaparthvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, I still have one more request.



@pytest.mark.tier(2)
@pytest.mark.provider([VMwareProvider], scope="module")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@pytest.mark.provider([VMwareProvider], scope="module")
@pytest.mark.provider([InfraProvider], scope="module", selector=ONE)

This will create test like - test_xyz[virtualcenter-datastore]

The test currently has a name like test_xyz[virtualcenter-6.5-datastore]. If the name of this provider changes, the test ID and name will also change which we want to avoid as fas as possible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dgaikwad I agree with @valaparthvi here, we should change this to InfraProvider

@jarovo
Copy link
Contributor

jarovo commented Mar 13, 2020

There is test_provision_approval doing very similar thing.

def test_provision_approval(appliance, provider, vm_name, smtp_test, request,


@pytest.mark.tier(2)
@pytest.mark.provider([VMwareProvider], scope="module")
@pytest.mark.meta(automate=[1380197])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@pytest.mark.meta(automate=[1380197])
@pytest.mark.meta(automates=[1380197])

@john-dupuy john-dupuy changed the title [RFR] - Test to check email pending status [WIPTEST] - Test to check email pending status Mar 13, 2020
@dgaikwad dgaikwad force-pushed the test_service_catalog_email_request_approval_pending branch from 7e4d654 to 2205e08 Compare March 16, 2020 08:13
@dgaikwad dgaikwad changed the title [WIPTEST] - Test to check email pending status [RFR] - Test to check email pending status Mar 16, 2020
Copy link
Contributor

@john-dupuy john-dupuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 small change, otherwise LGTM



@pytest.mark.tier(2)
@pytest.mark.provider([VMwareProvider], scope="module")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dgaikwad I agree with @valaparthvi here, we should change this to InfraProvider

@john-dupuy john-dupuy changed the title [RFR] - Test to check email pending status [WIPTEST] - Test to check email pending status Mar 20, 2020
@john-dupuy
Copy link
Contributor

LGTM @valaparthvi can we move this one to 1LP?

@valaparthvi valaparthvi changed the title [RFR] - Test to check email pending status [1LP][RFR] - Test to check email pending status Mar 24, 2020
@mshriver mshriver self-assigned this Mar 26, 2020
Copy link
Member

@mshriver mshriver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @JaryN pointed out, I think this is duplicated test coverage for something that is already automated, and this test case should not be added.

pending_from = normalize_text("{} request from {}pending approval".format(vm_type, requester))

In the existing test case, provision approval is set to manual, and we're asserting against the smtp queue that a pending approval email is sent.

This test case can be covered by simply adding the LogValidator to the existing test, after the SMTP check.

@mshriver mshriver changed the title [1LP][RFR] - Test to check email pending status [WIP] - Test to check email pending status Mar 26, 2020
matched_patterns=[
(
r'INFO.*Invoking \[builtin\] method \[/\$/Object/send_email\] with '
r'inputs.*Service Request from Pending Approval'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like its actually missing the from value? Is there a bug with CFME logging here?

Copy link
Contributor

@jarovo jarovo Mar 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mshriver I reported this issue for some infra provider at first. They fixed only for Infra and I didn't bother to verify with some other by hand, but I think meanwhile hard-coded exception for cloud providers was added. I have no idea why the person putting it there did that.

I hope after BZ 1818172 is closed, all providers will behave the same.

@jarovo
Copy link
Contributor

jarovo commented Mar 26, 2020

As @JaryN pointed out, I think this is duplicated test coverage for something that is already automated, and this test case should not be added.

pending_from = normalize_text("{} request from {}pending approval".format(vm_type, requester))

In the existing test case, provision approval is set to manual, and we're asserting against the smtp queue that a pending approval email is sent.

This test case can be covered by simply adding the LogValidator to the existing test, after the SMTP check.

Note there is ongoing PR I started recently:
#10019
which is modifying the test to do some checks for request denial. If the log message really has to be checked, I can include it in the PR or make a followup.

@dgaikwad
Copy link
Contributor Author

@mshriver, @JaryN so do we need to close this PR without merging it as we have the same test covered in another test case?

@jarovo
Copy link
Contributor

jarovo commented Mar 30, 2020

@mshriver, @JaryN so do we need to close this PR without merging it as we have the same test covered in another test case?

The bug is about message not being send. Although checking log message about email sent attempt may be considered enough, we are doing more in the test I am owner of.

The test I am owner of is not making service request but just simple provisioning. I think though the service request is just some "wrapper" around normal provisioning and calls the exactly the same parts. I think it is not worthy to spend time on implementing the checking with service requests.

Also, as I am mentioning in BZ 1818172, I think the email to users are quirky in setting up as I was unable to find a way how to specify the recipient address (@dgaikwad do you know? I think it is somewhere in automate). I have doubts that they are used in real-life.

@dgaikwad
Copy link
Contributor Author

@JaryN Sorry but I am not aware of setting up recipient address

@dgaikwad dgaikwad force-pushed the test_service_catalog_email_request_approval_pending branch from c6d40df to 87e180f Compare March 31, 2020 10:04
@dgaikwad dgaikwad changed the title [WIP] - Test to check email pending status [RFR] - Test to check email pending status Mar 31, 2020
@dgaikwad dgaikwad changed the title [RFR] - Test to check email pending status [RFR] - Removing duplicate tc Mar 31, 2020
@dgaikwad dgaikwad force-pushed the test_service_catalog_email_request_approval_pending branch from 87e180f to a9c32bc Compare March 31, 2020 10:09
@dgaikwad
Copy link
Contributor Author

@JaryN , @mshriver I have updated TC as per comment please review

@jarovo jarovo changed the title [RFR] - Removing duplicate tc [1LP][RFR] - Removing duplicate tc Apr 1, 2020
@mshriver mshriver merged commit b862fee into ManageIQ:master Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lint-ok test-automation To be applied on PR's which are automating existing manual cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants