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

Downloader pattern #355

Closed
wants to merge 21 commits into from
Closed

Downloader pattern #355

wants to merge 21 commits into from

Conversation

d4v1d03
Copy link
Contributor

@d4v1d03 d4v1d03 commented May 30, 2024

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

  • N
  • Y

2. What is the scope of this PR (e.g. component or file name):

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

d4v1d03 and others added 16 commits May 24, 2024 16:57
Signed-off-by: d4v1d03 <a_pandey1@ce.iitr.ac.in>
Signed-off-by: d4v1d03 <a_pandey1@ce.iitr.ac.in>
Signed-off-by: d4v1d03 <a_pandey1@ce.iitr.ac.in>
Signed-off-by: d4v1d03 <a_pandey1@ce.iitr.ac.in>
Signed-off-by: d4v1d03 <a_pandey1@ce.iitr.ac.in>
Signed-off-by: d4v1d03 <a_pandey1@ce.iitr.ac.in>
Signed-off-by: d4v1d03 <amit08072005@gmail.com>
Signed-off-by: d4v1d03 <amit08072005@gmail.com>
Signed-off-by: d4v1d03 <amit08072005@gmail.com>
Signed-off-by: d4v1d03 <amit08072005@gmail.com>
Signed-off-by: d4v1d03 <amit08072005@gmail.com>
@d4v1d03
Copy link
Contributor Author

d4v1d03 commented May 30, 2024

@zong-zhe, @Peefy , please point out the issues and remaining functionalities that need to be covered.

@zong-zhe
Copy link
Contributor

Hi @d4v1d03

The test case isn't passing and it looks like GitDownloader does not work.

image

d4v1d03 and others added 4 commits May 31, 2024 03:13
Signed-off-by: d4v1d03 <amit08072005@gmail.com>
Signed-off-by: d4v1d03 <amit08072005@gmail.com>
@@ -918,7 +918,7 @@ func (c *KpmClient) AcquireTheLatestOciVersion(ociSource pkg.Oci) (string, error
// Download will download the dependency to the local path.
func (c *KpmClient) Download(dep *pkg.Dependency, homePath, localPath string) (*pkg.Dependency, error) {
if dep.Source.Git != nil {
err := c.DepDownloader.Download(*downloader.NewDownloadOptions(
err := c.DepDownloader.Download(*downloader.NewDownloadOptions(
Copy link
Contributor

Choose a reason for hiding this comment

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

Format this code.

func TestOciDownloader(t *testing.T) {
path_oci := getTestDir("test_oci")
if err := os.MkdirAll(path_oci, os.ModePerm); err != nil {
ociTestDir := getTestDir("oci_test_dir")
Copy link
Contributor

Choose a reason for hiding this comment

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

The purpose of the issue is to complete the GitDownloader. Please do not modify the content related to OCI Downloader.

t.Fatal(err)
}

defer func() {
_ = os.RemoveAll(path_git)
_ = os.RemoveAll(gitTestDir)
}()

gitDownloader := GitDownloader{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Separate this test case for GitDownloader and do not write it together with TestOciDownloader for OciDownloader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zong-zhe , done the same, don't know why there's a timeout occuring for my TestGitDownloader() function, can you please have a look

@d4v1d03 d4v1d03 closed this Jun 11, 2024
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

Successfully merging this pull request may close these issues.

Enhancement: kpm add command displaying optimization
3 participants