Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove if statement for unit tests #152

Merged
merged 2 commits into from
Feb 29, 2024
Merged

Remove if statement for unit tests #152

merged 2 commits into from
Feb 29, 2024

Conversation

wigging
Copy link
Collaborator

@wigging wigging commented Feb 29, 2024

The unit tests would only run on the main branch. This removes the if statement from the unit-tests.yml workflow so the tests run on push events for any branch.

@wigging
Copy link
Collaborator Author

wigging commented Feb 29, 2024

The unit tests fail because of the following test:

@pytest.mark.unit
def test_factory_activity_template_plugin_globus():
    """This test should be true all required fields are defined as well as all
    optional fields"""
    logger = logging.getLogger(__name__)
    msg_factory = MessageFactory(logger)
    activity_template = msg_factory.create_template(
        MessageType.ACTIVITY,
        ActivityType.PLUGIN,
        args={"plugin": "globus", "action": "transfer"},
    )[1]
    print(activity_template)
    no_fail = True
    try:
        activity_template.message_id = str(uuid.uuid4())
        activity_template.activity_id = str(uuid.uuid4())
        activity_template.agent_id = str(uuid.uuid4())
        activity_template.campaign_id = str(uuid.uuid4())
        activity_template.credential = {}
        activity_template.submission_time = str(int(time.time()))
        assert activity_template.body.parameters.transfer.type == "synchronous"
        assert activity_template.body.type == "PLUGIN"
        assert activity_template.body.plugin == "globus"
        activity_template.body.parameters.transfer.items[0].source = ""
        activity_template.body.parameters.transfer.items[0].destination = ""
        activity_template.needs = []
    except Exception as e:
        print(e)
        no_fail = False
    assert no_fail

It fails because of a globus key error. If I remove this test then all unit tests pass. Can this test be removed or changed so that it works with the current version of zambeze?

@tskluzac
Copy link
Collaborator

It can be removed and replaced with a test of the transfer_hippo module instead. But for now, just deleting that one is fine.

@wigging
Copy link
Collaborator Author

wigging commented Feb 29, 2024

The Unit Tests workflow is now passing so I'm going to merge with main.

@wigging wigging marked this pull request as ready for review February 29, 2024 21:21
@wigging wigging merged commit 3664afb into main Feb 29, 2024
1 check passed
@wigging wigging deleted the unit-tests branch February 29, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants