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

Add mock interface and avoid validating tokens #178

Merged
merged 3 commits into from
Aug 21, 2023

Conversation

kim-tsao
Copy link
Contributor

@kim-tsao kim-tsao commented Aug 16, 2023

What does this PR do?:

  • Expose the interface for mock testing parent URI references for external clients
  • Remove duplicate util functions. There are identical copies in the util and git packages and I believe this was done in order to avoid cyclic dependencies. Rather than maintain two copies, I will refactor everything into one package (util) which this may affect our clients if they use the util methods from the git package.
  • Ensure git vendor validation is in place for parent URI references. Similar to the main devfile scenario, we do not error out if absolute URL is not a supported git vendor
  • Fix test cases

Which issue(s) this PR fixes:

devfile/api#1216

PR acceptance criteria:

Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.

  • Open new test/doc issues under the devfile/api repo
  • Check each criteria if:
  • There is a separate tracking issue. Add the issue link under the criteria
    or
  • test/doc updates are made as part of this PR
  • If unchecked, explain why it's not needed

How to test changes / Special notes to the reviewer:

Signed-off-by: Kim Tsao <ktsao@redhat.com>
Signed-off-by: Kim Tsao <ktsao@redhat.com>
@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Patch coverage: 41.66% and project coverage change: +1.12% 🎉

Comparison is base (6c4a5b8) 59.72% compared to head (d4a4f5a) 60.84%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #178      +/-   ##
==========================================
+ Coverage   59.72%   60.84%   +1.12%     
==========================================
  Files          41       41              
  Lines        5125     5006     -119     
==========================================
- Hits         3061     3046      -15     
+ Misses       1868     1767     -101     
+ Partials      196      193       -3     
Files Changed Coverage Δ
pkg/util/mock.go 0.00% <0.00%> (ø)
pkg/devfile/parser/utils.go 64.35% <5.26%> (-35.65%) ⬇️
pkg/util/git.go 75.79% <10.00%> (ø)
pkg/devfile/parser/parser_mock.go 74.28% <74.28%> (ø)
pkg/devfile/parser/parse.go 64.71% <100.00%> (+4.00%) ⬆️
pkg/util/util.go 37.72% <100.00%> (+1.85%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
pkg/devfile/parser/parse.go Outdated Show resolved Hide resolved
@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package git
package util
Copy link
Member

Choose a reason for hiding this comment

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

curious why we decided to move here in this pkg.. Seems like they could be in git pkg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Originally, there were duplicates of the until functions in the git package because of cyclic dependencies. It was confusing because some of the parser code was using the same named functions in the util package while others were using the ones from the git package.

pkg/util/util.go Show resolved Hide resolved
Signed-off-by: Kim Tsao <ktsao@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Aug 21, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kim-tsao, maysunfaisal

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:
  • OWNERS [kim-tsao,maysunfaisal]

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

@kim-tsao kim-tsao merged commit 99a3776 into devfile:main Aug 21, 2023
4 of 5 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.

2 participants