-
Notifications
You must be signed in to change notification settings - Fork 213
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
Import rest of tests from kinvolk/ocicert #39
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,5 @@ const ( | |
DistAPIVersionValue string = "registry/2.0" | ||
|
||
UploadUuidKey string = "Docker-Upload-Uuid" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changed recently. Not sure to test against the docker values as well. Perhaps this could be a struct, to then have an array of them to iterate over. |
||
ContentDigest string = "Docker-Content-Digest" | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,23 @@ | |
// limitations under the License. | ||
|
||
package image | ||
|
||
import ( | ||
"crypto/sha256" | ||
"math/rand" | ||
"strconv" | ||
) | ||
|
||
func GenRandomBlob(blobLen int) string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this actually to get a "blob" or just a simple string? |
||
blob := "" | ||
for i := 0; i < blobLen; i++ { | ||
blob += strconv.Itoa(rand.Intn(9)) | ||
} | ||
return blob | ||
} | ||
|
||
func GetHash(inputStr string) string { | ||
h := sha256.New() | ||
h.Write([]byte(inputStr)) | ||
return string(h.Sum(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'm wondering if a next step could be to have a golang package much like https://github.com/docker/distribution/blob/master/registry/api/v2/descriptors.go#L237 that clients could import and this test suite could also use to validate against.