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

Optimization #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Optimization #28

wants to merge 1 commit into from

Conversation

777Denoiser
Copy link

@777Denoiser 777Denoiser commented Oct 28, 2024

No description provided.

Copy link
Contributor

@jsquyres jsquyres left a comment

Choose a reason for hiding this comment

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

It is unexpected that you closed #26 and then opened this PR (from the same source branch).

I think nearly all of my comments on #26 still apply to this PR.

@777Denoiser
Copy link
Author

I answered and resolved the comments on #26 and will get to creating the 2 requested unit tests by professor and create an extra third unit test, then I will then start working on the EDIS poster if all checks pass.

@777Denoiser
Copy link
Author

                 Added a 4 Multiple Unit Tests for the Optimization Portion which were all verified to work by the CI Test. In optimization_test.go, there are 4 distinct unit tests added under the main TestDownloadOptimization function:

"Valid File Not Redownloaded"
"Invalid File Redownloaded"
"Multiple Resources"
"Resource Management"

                 Each test focuses on a specific aspect of the optimization functionality, and they run as subtests using t.Run() within the main test function. The test outputs clearly show all 4 tests executing and passing successfully.

                 The optimization unit tests in optimization_test.go serve as critical validation for the download caching and verification features in the grabit repository. These tests ensure that the optimization logic works correctly across different scenarios that users might encounter.
                 
                 The "Valid File Not Redownloaded" test verifies a key optimization feature - when a file exists and its integrity matches the expected hash, grabit skips unnecessary downloads. This test confirms that the system properly validates existing files and avoids redundant network operations, improving performance and reducing bandwidth usage.
                 
                 The "Invalid File Redownloaded" test validates the security aspect of the optimization. When a file's integrity check fails (simulated by corrupting the file), the system correctly identifies the mismatch and triggers a fresh download. This ensures that compromised or corrupted files are automatically replaced with valid versions, maintaining security while still leveraging optimization when possible.
                 
                 The "Multiple Resources" test demonstrates how the optimization handles batch operations. It verifies that the system correctly manages multiple files, applying the optimization logic independently to each resource. This test ensures that optimization works at scale and handles complex scenarios where multiple files need different treatment based on their integrity status.
                 
                 The "Resource Management" test validates the underlying resource tracking functionality that supports the optimization feature. It confirms that resources can be properly added, verified, and removed from the lock file, which is essential for maintaining accurate records of which files should be optimized.
                 
                 Together, these tests form a comprehensive validation suite for the optimization features, ensuring reliable performance, security, and correct behavior across various real-world usage patterns. The tests use a controlled HTTP test server to provide consistent, reproducible results while validating both the optimization logic and its integration with grabit's existing resource management capabilities.

test/utils.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jsquyres jsquyres left a comment

Choose a reason for hiding this comment

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

Overall, I think the sentiment is the same here: some of these are interesting changes, but we really want to see a PR that is only the "don't re-download if the file already exists in the filesystem and validates properly".

Please move the other improvements / fixes to other PRs where they can be discussed separately.

cmd/dowload_test.go Outdated Show resolved Hide resolved
cmd/dowload_test.go Outdated Show resolved Hide resolved
internal/resource.go Show resolved Hide resolved
test/utils.go Outdated Show resolved Hide resolved
internal/lock.go Outdated Show resolved Hide resolved
internal/lock.go Outdated Show resolved Hide resolved
internal/resource.go Show resolved Hide resolved
internal/lock.go Outdated Show resolved Hide resolved
internal/optimization_test.go Outdated Show resolved Hide resolved
internal/optimization_test.go Outdated Show resolved Hide resolved
internal/optimization_test.go Outdated Show resolved Hide resolved
internal/optimization_test.go Outdated Show resolved Hide resolved
internal/optimization_test.go Outdated Show resolved Hide resolved
internal/optimization_test.go Outdated Show resolved Hide resolved
internal/optimization_test.go Outdated Show resolved Hide resolved
internal/resource.go Show resolved Hide resolved
@777Denoiser
Copy link
Author

hey thank you for listening to, and reading my comments :)

internal/resource.go Outdated Show resolved Hide resolved
internal/resource.go Outdated Show resolved Hide resolved
cmd/dowload_test.go Outdated Show resolved Hide resolved
cmd/dowload_test.go Show resolved Hide resolved
internal/resource.go Outdated Show resolved Hide resolved
internal/resource.go Outdated Show resolved Hide resolved
internal/resource.go Show resolved Hide resolved
internal/resource.go Show resolved Hide resolved
internal/resource.go Outdated Show resolved Hide resolved
@777Denoiser
Copy link
Author

thank you for being patient with this PR, i fixed most of the CI test errors :)

@777Denoiser
Copy link
Author

777Denoiser commented Nov 18, 2024

may i get the CI test to run please, thank you so much and apologies for bugging you i just want to make sure i get my part of the code completed before EDIS
@rabadin

internal/lock_test.go Outdated Show resolved Hide resolved
internal/lock_test.go Outdated Show resolved Hide resolved
@777Denoiser
Copy link
Author

Hey! after our meeting today i decided to remove and revert some things that we discussed in our meeting today @jsquyres

After reverting my code that i did to fix the CI test on lock_test.go and delete_test.go leaving just resource.go and dowload_test.go.

I now have the same error that i had before i had made the changes to my code to fix the CI test so that it would pass,

now i have a "go test ./cmd -v" error in:

FAIL: TestRunDownloadMultipleErrors
FAIL: TestRunDownloadWithTags
FAIL: TestRunDelete

These were the tests that i had fixed by adding lock_test.go and delete_test.go.

I am 100% positive that the CI test will not pass because of this change by deleting the other go files.

I am not sure how to proceed further to closing this PR i would like some guidance. @rabadin @jsquyres

Thank You!!

@rabadin
Copy link
Contributor

rabadin commented Nov 19, 2024

I am not sure how to proceed further to closing this PR i would like some guidance. @rabadin @jsquyres

The error is in red in the CI run output: Error: cmd/dowload_test.go:12:2: "runtime" imported and not used.
If you remove this the CI passes.

@777Denoiser
Copy link
Author

I am not sure how to proceed further to closing this PR i would like some guidance. @rabadin @jsquyres

The error is in red in the CI run output: Error: cmd/dowload_test.go:12:2: "runtime" imported and not used. If you remove this the CI passes.

thank you so much for letting me know, i accidentally figured it out while checking the goland ID, i removed it and hopefully the CI test passes now :)

best regards

cmd/dowload_test.go Outdated Show resolved Hide resolved
@777Denoiser
Copy link
Author

if this CI test passes i will squash my 30 commits down to one commit hopefully without error

if a file is already i the file system and it validates, we do not need to download it again.
@777Denoiser
Copy link
Author

@rabadin @jsquyres

Hello Raphael,

Me and Dr.Squyres during our meeting today we figured out the problem with why the commits were not squashing after a bit of troubleshooting,

Thanks to Dr.Squyres and his help I managed to get the 35 commits squashed down to 22 commits then 1 commit, all the while preserving the changes in the process.

We both have requested a review for this PR on your end to approve this PR for the merge.

Best Wishes and Happy Thanksgiving!

internal/resource.go Show resolved Hide resolved
internal/resource.go Show resolved Hide resolved
internal/resource.go Show resolved Hide resolved
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.

3 participants