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

Github unit tests #9

Closed
jmgasper opened this issue Aug 1, 2018 · 0 comments
Closed

Github unit tests #9

jmgasper opened this issue Aug 1, 2018 · 0 comments

Comments

@jmgasper
Copy link
Collaborator

jmgasper commented Aug 1, 2018

We need to implement unit tests for the Topcoder-X receiver and processor to ensure that all facets of ticket handling are processing correctly.

We will use these unit tests before and after deployments to prod to ensure:

  • An update works before it's deployed
  • The deployed code to prod is working as expected

Existing tests

Note that tests for Gitlab were recently checked in, with similar requirements to these Github tests. You can use those as reference, but note that the review identified some issues with those tests that have yet to be fixed:

Code reuse

Please refactor and reuse as much code between the Gitlab and Github implementations as possible. This will make it easier to maintain the code in the future.

Development

You can use the Github API to manipulate the tickets as needed. You need to ensure that you properly describe the configuration needed, including the API and Github project setup.

Your unit tests should not leave anything behind when they run. All cleanup should be part of the test setup and takedown.

You should use the Topcoder challenge API for validating the Topcoder platform challenge information. As with the Github issues, no Topcoder challenges should be left open when the unit tests are done.

Unit tests

The unit tests have to cover:

  • Creating a Github ticket

    • Ensure that the challenge is created properly in the Topcoder platform
    • Ensure that the challenge TC Direct ID matches the configured TC Direct ID in topcoder-x
    • Ensure that the challenge title, description, and prize matches the ticket title
    • Ensure that the comment added to the Git ticket is correct and has a proper link to the TC challenge
  • Updating a Github ticket - prize

    • Ensure that the prize is updated properly on the TC challenge
    • Ensure that the comment is added back to the Github ticket explaining that the prize was updated
  • Updating a Github ticket - title

    • Ensure that the title is updated properly on the TC challenge
  • Updating a Github ticket - description

    • Ensure that the description is updated properly on the TC challenge
  • Assign a Github ticket

    • Ensure that the TC member is added to the TC challenge as expected
    • If no mapping exists for the assignee on Github for a TC member, ensure a comment is added explaining that the user has to register with Topcoder X.
    • Ensure that a comment is added to the Github ticket with a success message when the assignment is successful
  • Unassign a Github ticket

    • Ensure that the TC challenge goes back to unassigned and the existing assignee is removed
    • Ensure that a comment is added to the Github ticket with a success message when the unassignment is successful.
  • Close a Github ticket

    • Ensure that the challenge is activated on the TC platform
    • Ensure that the copilot is assigned on the TC platform
    • Ensure that the challenge is closed successfully on the TC platform
    • If there's no assignee, ensure a comment is added to the Github ticket and the ticket is reopened
    • If an error occurs, ensure a comment is added to the Github ticket and the ticket is reopened

Running the unit tests

The code is deployed to Heroku for both development and prod environments. The unit tests should be able to be run on Heroku as part of the deployment.

https://devcenter.heroku.com/categories/continuous-integration

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

No branches or pull requests

1 participant