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

[RHTAPBUGS-418]multiple components with context path #346

Merged
merged 2 commits into from
Jul 12, 2023

Conversation

stuartwdouglas
Copy link
Contributor

@stuartwdouglas stuartwdouglas commented Jun 15, 2023

Test for RHTAPBUGS-418

What does this PR do?:

Test for an issue I saw in the UI where importing a project with multiple components and a context path set results in the context path going missing.

I could not get this test to run locally as all the detection tests are timing out for me.

Which issue(s)/story(ies) does this PR fixes:

https://issues.redhat.com/browse/RHTAPBUGS-418

@stuartwdouglas stuartwdouglas changed the title Test for multiple componets with context path test: multiple components with context path Jun 15, 2023
@@ -851,7 +851,28 @@ func DownloadDevfileAndDockerfile(url string) ([]byte, string, []byte, string) {
// Map 3 returns a context to the Dockerfile uri or a matched DockerfileURL from the devfile registry if no Dockerfile/Containerfile is present in the context
// Map 4 returns a context to the list of ports that were detected by alizer in the source code, at that given context
func ScanRepo(log logr.Logger, a Alizer, localpath string, devfileRegistryURL string, source appstudiov1alpha1.GitSource) (map[string][]byte, map[string]string, map[string]string, map[string][]int, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure if the original method could still be used anywhere else, so I added a new one instead

Copy link
Member

Choose a reason for hiding this comment

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

The original method should be fine to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the PR

@codecov
Copy link

codecov bot commented Jun 15, 2023

Codecov Report

Patch coverage: 83.20% and project coverage change: -0.81 ⚠️

Comparison is base (1afd7ae) 84.61% compared to head (eeef423) 83.81%.

❗ Current head eeef423 differs from pull request most recent head b053120. Consider uploading reports for the commit b053120 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #346      +/-   ##
==========================================
- Coverage   84.61%   83.81%   -0.81%     
==========================================
  Files          27       27              
  Lines        3530     4152     +622     
==========================================
+ Hits         2987     3480     +493     
- Misses        402      504     +102     
- Partials      141      168      +27     
Impacted Files Coverage Δ
controllers/component_controller.go 71.72% <54.09%> (-5.88%) ⬇️
pkg/devfile/detect.go 71.42% <66.66%> (-1.23%) ⬇️
controllers/componentdetectionquery_controller.go 69.85% <74.54%> (-0.69%) ⬇️
pkg/github/token_mock.go 75.67% <75.67%> (-24.33%) ⬇️
...pplicationsnapshotenvironmentbinding_controller.go 82.50% <77.88%> (-2.43%) ⬇️
pkg/github/token.go 87.74% <84.95%> (-7.65%) ⬇️
pkg/util/util.go 95.63% <89.36%> (-0.78%) ⬇️
pkg/github/mock.go 94.25% <90.99%> (-5.75%) ⬇️
pkg/devfile/devfile.go 84.37% <93.45%> (+1.17%) ⬆️
controllers/application_controller.go 83.64% <100.00%> (+2.11%) ⬆️
... and 11 more

... and 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.

@stuartwdouglas stuartwdouglas changed the title test: multiple components with context path bug: multiple components with context path Jun 15, 2023
@stuartwdouglas stuartwdouglas force-pushed the component-test branch 2 times, most recently from 8f22e40 to 5940a4f Compare June 29, 2023 01:55
@stuartwdouglas
Copy link
Contributor Author

Does this need any more action on my part?

@@ -284,7 +284,7 @@ func (r *ComponentDetectionQueryReconciler) Reconcile(ctx context.Context, req c
if isMultiComponent {
log.Info(fmt.Sprintf("Since this is a multi-component, attempt will be made to read only level 1 dir for devfiles... %v", req.NamespacedName))

devfilesMap, devfilesURLMap, dockerfileContextMap, componentPortsMap, err = devfile.ScanRepo(log, r.AlizerClient, componentPath, r.DevfileRegistryURL, source)
devfilesMap, devfilesURLMap, dockerfileContextMap, componentPortsMap, err = devfile.ScanRepo(log, r.AlizerClient, source.Context, componentPath, r.DevfileRegistryURL, source)
Copy link
Contributor

Choose a reason for hiding this comment

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

the source is already been passed in as a arg. no need an extra arg for source.Context

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, fixed

@stuartwdouglas stuartwdouglas force-pushed the component-test branch 4 times, most recently from 9896d84 to b40acdb Compare July 7, 2023 03:23
pkg/devfile/devfile.go Outdated Show resolved Hide resolved
pkg/devfile/detect.go Outdated Show resolved Hide resolved
@stuartwdouglas
Copy link
Contributor Author

Fixed

} else if !strings.HasSuffix(originalContext, "/") {
originalContext += "/"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

do not need this code change. the context will never be empty. as it's already set in

if context == "" {
context = "./"
}

and with the path.join, you do not need to append / at the end

@yangcao77 yangcao77 changed the title bug: multiple components with context path [RHTAPBUGS-418]multiple components with context path Jul 8, 2023
@openshift-ci openshift-ci bot added the lgtm label Jul 12, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jul 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: stuartwdouglas, yangcao77

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

@yangcao77 yangcao77 merged commit 461b932 into redhat-appstudio:main Jul 12, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants