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

Test workflow not running in pr-open Github Action #105

Closed
tobiasmllr opened this issue Mar 18, 2024 · 5 comments
Closed

Test workflow not running in pr-open Github Action #105

tobiasmllr opened this issue Mar 18, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@tobiasmllr
Copy link
Collaborator

@DerekRoberts Thank you for fixing the earlier problems! Now I see that my testing step does not run correctly. Could you give me a hint how I can execute a test from within the deployed docker container?

You can see the error in the failed step of #102

Run docker exec -it rctool /bin/bash -c "python manage.py test"
Error response from daemon: No such container: rctool
Error: Process completed with exit code 1.

This is my Tests step, basically I just want to run python manage.py test from within the rctool docker container

  tests:
    name: Run Tests for Django App
    needs: [deploys]
    runs-on: ubuntu-22.04
    steps:
      - name: Run Django Tests in frontend docker container
        run: |
          docker exec -it rctool /bin/bash -c "python manage.py test"
@tobiasmllr tobiasmllr added the bug Something isn't working label Mar 18, 2024
@DerekRoberts
Copy link
Member

@tobiasmllr Tests are usually run outside of the container, like in the example below. Should I make changes to your PR?

https://github.com/bcgov/quickstart-openshift-backends/blob/main/.github/workflows/analysis.yml#L130

@mishraomp
Copy link
Collaborator

mishraomp commented Mar 18, 2024

@tobiasmllr are you running tests in a mock environment, or are you spinning up a container to run tests inside that container, could you elaborate what you are trying to do. GitHub Actions cannot reach the container running in OpenShift directly , until you are trying to do endpoint test over HTTP which is possible.

cc @DerekRoberts

@tobiasmllr
Copy link
Collaborator Author

Hello, thanks for looking at this so quickly! I finished the previous pull request as it was already too busy, I removed the test-step from that version.

Yes, I see now where the test goes, but I'm still not sure how to specify which docker container it runs in, based on your link @DerekRoberts. If you know where it goes, feel free to edit the analysis.yml

@mishraomp I would like to run the test in a running version of the docker image that was built successfully. It does run self contained and should work similar to the pytest example Derek linked, but Django just has it's own invocation for the test (python manage.py test)

@mishraomp
Copy link
Collaborator

thanks @tobiasmllr ,maybe we can spin up rctool container within GHA itself and run tests within that

or else we have to look into oc exec
https://docs.openshift.com/container-platform/4.15/cli_reference/openshift_cli/developer-cli-commands.html#oc-exec

cc @DerekRoberts

@DerekRoberts
Copy link
Member

Solved in helpers repo! Thanks @tobiasmllr for catching a potentially very painful bug. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants