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
CFE-977, CFE-978, CFE-982: Introduce history interface with its Reader and Append implementation #736
Conversation
@aguidirh: This pull request references CFE-982 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.15.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2/pkg/history/history.go
Outdated
} | ||
|
||
func isHistoryFile(historyFile fs.DirEntry) bool { | ||
return !historyFile.IsDir() && strings.Contains(historyFile.Name(), historyNamePrefix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or hasPrefix?
|
||
var log clog.PluggableLoggerInterface | ||
|
||
type OSFileCreator struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea!
func (m MockFileCreator) Create(name string) (io.WriteCloser, error) { | ||
m.Buffer = new(bytes.Buffer) | ||
return nopCloser{m.Buffer}, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea! no tmp folder, no files on disk!
👍
} else { | ||
assert.NoError(t, err) | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way you could also compare the new history content to expectedHist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aguidirh - agreed great work - nice and clean
/test sanity |
/retest |
1 similar comment
/retest |
@aguidirh: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aguidirh, sherine-k 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 |
/label acknowledge-critical-fixes-only |
[ART PR BUILD NOTIFIER] This PR has been included in build oc-mirror-plugin-container-v4.15.0-202311232032.p0.gef36dd9.assembly.stream for distgit oc-mirror-plugin. |
Description
This feature creates and read a history file. This file contains all blobs mirrored in a mirrorToDisk flow.
The
Read func
will get the latest history file (format is.history-time.RFC3339
example:.history-2023-11-22T11:24:14Z
) if no date is specified. In case a date is specified in the NewHistory func, the Read func will return the latest history before the specified date.The
Append func
will call theRead func
to get the blobs from a previous history file and will generate a new history file with the content of the previous history file + the new blobs mirrored in the current run.Fixes # CFE-977, CFE-978 and CFE-982
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Unit test under
v2/pkg/history/history_test.go
Expected Outcome
Unit tests should
pass