Skip to content

Conversation

amisevsk
Copy link
Collaborator

@amisevsk amisevsk commented Jun 12, 2023

What does this PR do?

In verifying PR #1115, I worked on a semi-automatic regression test for project-clone functionality to ensure the PR wasn't breaking existing behavior. I figured it's worth adding this to the repository so that it's not lost to time.

This PR adds sample DevWorkspaces to project-clone/test/ that tests project clone functionality at a basic level: they verify that projects can be cloned, and that branches, tags, and revisions can be correctly checked out from both the origin and a fork of the repository. If any project is not set up as expected, the workspace enters a failed state (potentially after a few restarts), indicating that there is a problem. If the "test" "succeeds", the workspace enters and stays in a running state. Logs for a successful test look like

Defaulted container "test-project-clone" out of: test-project-clone, project-clone (init)
Testing default project set up
Project is on main, tracking main-origin/main, with remotes configured
Testing branch checkout project set up
Project is on 0.21.x, tracking origin/0.21.x, with remotes configured
Testing tag checkout project set up
Project is on tag v0.21.0, with remotes configured
Testing hash checkout project set up
Project is on commit 79ed3e1ef80da390f7793777c658ecbd13260adc, with remotes configured
[SUCCESS] Test succeeded. Sleeping indefinitely

The workspace makes use of devfile variables to enable configuration of the key elements being tested (main repo, fork repo, branch, tag, revision) so that it can more easily be adapted in the future (though it is harder to read as a result)

The project-clone-test-basic.devworkspace.yaml file is a simpler, more basic test of the functionality above -- it just verifies that we can successfully clone a project from a repository. It was useful for testing that #1114 was resolved (where the self-signed certificates repo I used to test did not have a fork, branches, tags, etc.)

What issues does this PR fix or reference?

N/A

Is it tested? How?

Tests can be run by applying these DevWorkspaces to any cluster where DWO is installed.

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

@amisevsk amisevsk requested review from AObuchow and l0rd as code owners June 12, 2023 20:39
@amisevsk
Copy link
Collaborator Author

/retest

@codecov
Copy link

codecov bot commented Jun 13, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.03 ⚠️

Comparison is base (7f2085d) 51.93% compared to head (a29da43) 51.90%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1124      +/-   ##
==========================================
- Coverage   51.93%   51.90%   -0.03%     
==========================================
  Files          80       80              
  Lines        7356     7356              
==========================================
- Hits         3820     3818       -2     
- Misses       3248     3249       +1     
- Partials      288      289       +1     

see 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@AObuchow AObuchow left a comment

Choose a reason for hiding this comment

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

Awesome work @amisevsk 👍
Tested how things look like when the test case succeeds & when there's a failure (I used a fake git repo URL for the fork_repo URL variable to cause the test to fail).

@openshift-ci openshift-ci bot added the lgtm label Jun 15, 2023
@amisevsk amisevsk force-pushed the project-clone-test-devworkspace branch from 5949014 to 1ce8a77 Compare June 15, 2023 15:49
@openshift-ci openshift-ci bot removed the lgtm label Jun 15, 2023
@amisevsk
Copy link
Collaborator Author

Accidentally forgot to push the project-clone-test-basic.devworkspace.yaml file... pushed now.

echo "Project is on $branch_name, tracking $tracking_branch, with remotes configured"

echo "Test succeeded. Sleeping indefinitely"
tail -f /dev/null No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is missing a newline? But looks good to me otherwise

@openshift-ci openshift-ci bot added the lgtm label Jun 15, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 15, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk, AObuchow

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Add devworkspace project-clone/test/project-clone-test.devworkspace.yaml
to allow for semi-automatic testing of the project-clone container. This
workspace is set up to run a bash script (stored in the .command field)
on start that verifies that projects have been set up as expected.

If projects were not set up correctly, the workspace enters a failed
state and logs for the workspace container can be checked for the cause
of the failure.

The workspace makes use of devfile variables to enable configuration of
the key elements being tested (main repo, fork repo, branch, tag,
revision)

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
@amisevsk amisevsk force-pushed the project-clone-test-devworkspace branch from 1ce8a77 to a29da43 Compare June 16, 2023 19:43
@openshift-ci openshift-ci bot removed the lgtm label Jun 16, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 16, 2023

New changes are detected. LGTM label has been removed.

@amisevsk amisevsk merged commit 05519ae into devfile:main Jun 16, 2023
@amisevsk amisevsk deleted the project-clone-test-devworkspace branch June 16, 2023 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants