summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp4
-rw-r--r--test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp30
-rw-r--r--test/buildtool/execution_api/bazel/bazel_network.test.cpp23
-rw-r--r--test/buildtool/execution_api/bazel/bytestream_client.test.cpp4
-rw-r--r--test/buildtool/execution_engine/executor/executor.test.cpp4
5 files changed, 34 insertions, 31 deletions
diff --git a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp
index 09e0a426..488483ae 100644
--- a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp
@@ -78,7 +78,7 @@ TEST_CASE("Bazel internals: CAS Client", "[execution_api]") {
// Read blob
auto blobs = cas_client.BatchReadBlobs(instance_name, {digest});
REQUIRE(blobs.size() == 1);
- CHECK(blobs.begin()->digest == digest);
- CHECK(*blobs.begin()->data == content);
+ CHECK(blobs.begin()->GetDigest() == digest);
+ CHECK(*blobs.begin()->ReadContent() == content);
}
}
diff --git a/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp b/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp
index 33748769..6b106bc7 100644
--- a/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp
@@ -81,24 +81,24 @@ TEST_CASE("Bazel internals: MessageFactory", "[execution_api]") {
CHECK(link_blob);
// both files are the same and should result in identical blobs
- CHECK(*file1_blob->data == *file2_blob->data);
- CHECK(file1_blob->digest.hash() == file2_blob->digest.hash());
- CHECK(file1_blob->digest.size() == file2_blob->digest.size());
+ CHECK(*file1_blob->ReadContent() == *file2_blob->ReadContent());
+ CHECK(file1_blob->GetDigest().hash() == file2_blob->GetDigest().hash());
+ CHECK(file1_blob->GetDigest().size() == file2_blob->GetDigest().size());
// create known artifacts
- auto artifact1_opt =
- ArtifactDescription::CreateKnown(file1_blob->digest, ObjectType::File)
- .ToArtifact();
+ auto artifact1_opt = ArtifactDescription::CreateKnown(
+ file1_blob->GetDigest(), ObjectType::File)
+ .ToArtifact();
auto artifact1 = DependencyGraph::ArtifactNode{std::move(artifact1_opt)};
- auto artifact2_opt =
- ArtifactDescription::CreateKnown(file2_blob->digest, ObjectType::File)
- .ToArtifact();
+ auto artifact2_opt = ArtifactDescription::CreateKnown(
+ file2_blob->GetDigest(), ObjectType::File)
+ .ToArtifact();
auto artifact2 = DependencyGraph::ArtifactNode{std::move(artifact2_opt)};
- auto artifact3_opt =
- ArtifactDescription::CreateKnown(link_blob->digest, ObjectType::Symlink)
- .ToArtifact();
+ auto artifact3_opt = ArtifactDescription::CreateKnown(
+ link_blob->GetDigest(), ObjectType::Symlink)
+ .ToArtifact();
auto artifact3 = DependencyGraph::ArtifactNode{std::move(artifact3_opt)};
// create directory tree
@@ -111,9 +111,9 @@ TEST_CASE("Bazel internals: MessageFactory", "[execution_api]") {
// a mapping between digests and content is needed; usually via a concrete
// API one gets this content either locally or from the network
std::unordered_map<ArtifactDigest, std::filesystem::path> fake_cas{
- {file1_blob->digest, file1},
- {file2_blob->digest, file2},
- {link_blob->digest, link}};
+ {file1_blob->GetDigest(), file1},
+ {file2_blob->GetDigest(), file2},
+ {link_blob->GetDigest(), link}};
// create blobs via tree
std::unordered_set<ArtifactBlob> blobs{};
diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
index 47ddee6c..1bc6c0ac 100644
--- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
@@ -87,8 +87,11 @@ TEST_CASE("Bazel network: write/read blobs", "[execution_api]") {
// Read blobs in order
auto reader = network.CreateReader();
- std::vector<ArtifactDigest> to_read{
- foo.digest, bar.digest, baz.digest, bar.digest, foo.digest};
+ std::vector<ArtifactDigest> to_read{foo.GetDigest(),
+ bar.GetDigest(),
+ baz.GetDigest(),
+ bar.GetDigest(),
+ foo.GetDigest()};
std::vector<ArtifactBlob> blobs{};
for (auto next : reader.ReadIncrementally(&to_read)) {
blobs.insert(blobs.end(), next.begin(), next.end());
@@ -96,11 +99,11 @@ TEST_CASE("Bazel network: write/read blobs", "[execution_api]") {
// Check order maintained
REQUIRE(blobs.size() == 5);
- CHECK(*blobs[0].data == content_foo);
- CHECK(*blobs[1].data == content_bar);
- CHECK(*blobs[2].data == content_baz);
- CHECK(*blobs[3].data == content_bar);
- CHECK(*blobs[4].data == content_foo);
+ CHECK(*blobs[0].ReadContent() == content_foo);
+ CHECK(*blobs[1].ReadContent() == content_bar);
+ CHECK(*blobs[2].ReadContent() == content_baz);
+ CHECK(*blobs[3].ReadContent() == content_bar);
+ CHECK(*blobs[4].ReadContent() == content_foo);
}
TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") {
@@ -149,7 +152,7 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") {
// Read blobs
auto reader = network.CreateReader();
- std::vector<ArtifactDigest> to_read{foo.digest, bar.digest};
+ std::vector<ArtifactDigest> to_read{foo.GetDigest(), bar.GetDigest()};
std::vector<ArtifactBlob> blobs{};
for (auto next : reader.ReadIncrementally(&to_read)) {
blobs.insert(blobs.end(), next.begin(), next.end());
@@ -157,6 +160,6 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") {
// Check order maintained
REQUIRE(blobs.size() == 2);
- CHECK(*blobs[0].data == content_foo);
- CHECK(*blobs[1].data == content_bar);
+ CHECK(*blobs[0].ReadContent() == content_foo);
+ CHECK(*blobs[1].ReadContent() == content_bar);
}
diff --git a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
index 98bd371b..4676a5c6 100644
--- a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
+++ b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
@@ -61,7 +61,7 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") {
auto const downloaded_blob = stream.Read(instance_name, digest);
REQUIRE(downloaded_blob.has_value());
- CHECK(*downloaded_blob->data == content);
+ CHECK(*downloaded_blob->ReadContent() == content);
}
SECTION("Small blob with wrong digest") {
@@ -97,7 +97,7 @@ TEST_CASE("ByteStream Client: Transfer single blob", "[execution_api]") {
SECTION("Download large blob") {
auto const downloaded_blob = stream.Read(instance_name, digest);
REQUIRE(downloaded_blob.has_value());
- CHECK(*downloaded_blob->data == content);
+ CHECK(*downloaded_blob->ReadContent() == content);
}
SECTION("Incrementally download large blob") {
diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp
index af7590bb..36b407c7 100644
--- a/test/buildtool/execution_engine/executor/executor.test.cpp
+++ b/test/buildtool/execution_engine/executor/executor.test.cpp
@@ -226,12 +226,12 @@ class TestApi : public IExecutionApi {
return std::all_of(
blobs.begin(), blobs.end(), [this](auto const& blob) {
// for local artifacts
- auto it1 = config_.artifacts.find(*blob.data);
+ auto it1 = config_.artifacts.find(*blob.ReadContent());
if (it1 != config_.artifacts.end() and it1->second.uploads) {
return true;
}
// for known and action artifacts
- auto it2 = config_.artifacts.find(blob.digest.hash());
+ auto it2 = config_.artifacts.find(blob.GetDigest().hash());
return it2 != config_.artifacts.end() and it2->second.uploads;
});
}