mirror of
https://github.com/cirruslabs/tart.git
synced 2026-10-22 03:24:40 +02:00
* Support pulling/pushing VMs to OCI-compatible registries
* Registry: rename request() to endpointRequest() for clarity
* Registry: include JSON details on HTTP status code mismatch errors
* .cirrus.yml: run tests
* Fix testDigest
* Registry: set Content-{Length,Type} headers when pushing blob
* Refactor Registry.auth() and enrich RegistryError.AuthFailed
* Remove useless comment
* Fix WWWAuthenticate a bit and add tests
* WWWAuthenticate: expect a Bearer scheme
* Registry.auth(): document the passing of ["scope", "service"] parameters
* Clarify unexpected HTTP code error when retrieving auth token
* Make RemoteName parser more relaxed for now
* tart clone: pull the VM if it's OCI-based first
* VMStorageOCI: ensure the old symbolic link is overwritten
* tart push: support multiple remote VM names
* Logging: push/pull progress
* Use 500 MB chunks (instead of 500 MiB) to evenly cut disk
...which also uses powers of 10.
* Credentials: only read credentials labeled "Tart Credentials"
25 lines
810 B
Swift
25 lines
810 B
Swift
import XCTest
|
|
@testable import tart
|
|
|
|
final class DigestTests: XCTestCase {
|
|
func testEmptyData() throws {
|
|
let data = Data("".utf8)
|
|
|
|
let digest = Digest()
|
|
digest.update(data)
|
|
XCTAssertEqual(digest.finalize(), "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
|
|
|
XCTAssertEqual(Digest.hash(data), "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
|
}
|
|
|
|
func testNonEmptyData() throws {
|
|
let data = Data("The quick brown fox jumps over the lazy dog".utf8)
|
|
|
|
let digest = Digest()
|
|
digest.update(data)
|
|
XCTAssertEqual(digest.finalize(), "sha256:d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592")
|
|
|
|
XCTAssertEqual(Digest.hash(data), "sha256:d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592")
|
|
}
|
|
}
|