提交 87e4f020 编写于 作者: W wujing 提交者: lifeng68

iSulad oci images store

Signed-off-by: Nwujing <wujing50@huawei.com>
上级 29f8ae8a
......@@ -50,6 +50,8 @@
#define ETC_FILE_MODE 0755
#define IMAGE_STORE_PATH_MODE 0700
#define ISULAD_CONFIG "/etc/isulad"
#define ISULAD_DAEMON_JSON_CONF_FILE ISULAD_CONFIG "/daemon.json"
......
此差异已折叠。
/******************************************************************************
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
* iSulad licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
* You may obtain a copy of Mulan PSL v1 at:
* http://license.coscl.org.cn/MulanPSL
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v1 for more details.
* Author: wujing
* Create: 2020-03-13
* Description: provide images module interface definition
******************************************************************************/
#ifndef __OCI_STORAGE_IMAGES_H
#define __OCI_STORAGE_IMAGES_H
#include <stdbool.h>
#include <string.h>
#include <pthread.h>
#include "storage_image.h"
#include "timestamp.h"
#include "map.h"
#ifdef __cplusplus
extern "C" {
#endif
// the name of the big data item whose contents we consider useful for computing a "digest" of the
// image, by which we can locate the image later.
#define IMAGE_DIGEST_BIG_DATA_KEY "manifest"
#define IMAGE_NAME_LEN 64
typedef struct file_locker {
// key: string value: struct flock
map_t *lock_files;
pthread_mutex_t lock_files_lock;
} file_locker_t;
typedef struct digest_image {
storage_image **images;
size_t images_len;
} digest_image_t;
typedef struct image_store {
file_locker_t lockfile;
file_locker_t rolockfile;
char *dir;
storage_image **images;
size_t images_len;
map_t *idindex;
map_t *byid;
map_t *byname;
map_t *bydigest;
// flag for daemon
bool daemon;
bool loaded;
} image_store_t, *image_store_ptr;
// // ROImageStore interface: Provides bookkeeping for information about Images.
// typedef struct ro_image_store_ops {
// // TODO: ROFileBasedStore
// // TODO: ROMetadataStore
// // TODO: ROBigDataStore
//
// // Check if there is an image with the given ID or name.
// bool (*exists)(const char *id);
//
// // Retrieve information about an image given an ID or name.
// int (*get)(const char *id, storage_image *image);
//
// // Attempt to translate a name to an ID. Most methods do this implicitly.
// int (*lookup)(const char *name, char **id);
//
// // Return a slice enumerating the known images.
// int (*images)(storage_image **images, size_t *len);
//
// // Return a slice enumerating the images which have a big data
// // item with the name ImageDigestBigDataKey and the specified digest.
// int (*by_digest)(storage_image **images, size_t *len);
// } ro_image_store_ops_t;
//
// // ImageStore interface: Provides bookkeeping for information about Images.
// typedef struct image_store_opt {
// // ROImageStore
// // RWFileBasedStore
// // RWMetadataStore
// // RWBigDataStore
// // FlaggableStore
//
// // Create an image that has a specified ID (or a random one) and
// // optional names, using the specified layer as its topmost (hopefully
// // read-only) layer. That layer can be referenced by multiple images.
// int (*create)(const char *id, const char **names, size_t names_len, const char *layer, const char *metadata,
// timestamp time, const char *searchable_digest, storage_image *image);
//
// // Replace the list of names associated with an image with the supplied values.
// int (*set_names)(const char *id, const char **names, size_t names_len);
//
// // Remove the record of the image.
// int (*delete)(const char *id);
//
// // Remove records of all images
// int (*wipe)();
//
// // Set the image pulled time
// int (*set_loaded_time)(const char *id, timestamp loaded);
//
// // Add the name for an image. Duplicate names are removed from the list automatically.
// int (*add_name)(const char *id, const char *name);
// } image_store_ops_t;
//
int new_image_store(bool daemon, bool readonly, const char *dir, image_store_t **image_store);
void free_image_store(image_store_t *image_store);
#ifdef __cplusplus
}
#endif
#endif /* __OCI_STORAGE_IMAGES_H */
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"digest": {
"type": "string"
},
"names": {
"type": "array",
"items": {
"type": "string"
}
},
"layer": {
"type": "string"
},
"mapped-layers": {
"type": "array",
"items": {
"type": "string"
}
},
"metadata": {
"type": "string"
},
"big-data-names": {
"type": "array",
"items": {
"type": "string"
}
},
"big-data-sizes": {
"$ref": "../defs.json#/definitions/mapStringInt64"
},
"big-data-digests": {
"$ref": "../defs.json#/definitions/mapStringString"
},
"created": {
"type": "string"
},
"loaded": {
"type": "string"
}
}
}
......@@ -75,6 +75,8 @@ static int plugin_event_post_remove_handle(const plugin_t *plugin, const char *c
enum plugin_action { ACTIVE_PLUGIN, DEACTIVE_PLUGIN };
plugin_manager_t *g_plugin_manager;
static inline int check_err(int err, const char *msg)
{
if (err) {
......
......@@ -37,10 +37,10 @@ find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIR})
include_directories(${GMOCK_INCLUDE_DIRS})
add_subdirectory(cutils)
# add_subdirectory(cutils)
add_subdirectory(image)
add_subdirectory(path)
add_subdirectory(cmd)
add_subdirectory(runtime)
add_subdirectory(specs)
add_subdirectory(services)
# add_subdirectory(path)
# add_subdirectory(cmd)
# add_subdirectory(runtime)
# add_subdirectory(specs)
# add_subdirectory(services)
project(iSulad_UT)
add_subdirectory(oci_config_merge)
# add_subdirectory(oci_config_merge)
add_subdirectory(storage)
project(iSulad_LLT)
add_subdirectory(images)
project(iSulad_LLT)
SET(EXE storage_images_llt)
add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cutils/utils.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cutils/utils_regex.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cutils/utils_verify.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cutils/utils_array.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cutils/utils_string.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cutils/utils_convert.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cutils/utils_file.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cutils/util_atomic.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/log.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/sha256/sha256.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/path.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/map/map.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/map/rb_tree.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/json/schema/src/read_file.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/types_def.c
${CMAKE_BINARY_DIR}/json/json_common.c
${CMAKE_BINARY_DIR}/json/defs.c
${CMAKE_BINARY_DIR}/json/storage_image.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/image/oci/storage/image_store/image_store.c
storage_images_llt.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../include
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cutils
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/map
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/sha256
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/json/schema/src
${CMAKE_BINARY_DIR}/conf
${CMAKE_BINARY_DIR}/json
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/image/oci/storage/image_store
)
target_link_libraries(${EXE} ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARY} ${GMOCK_MAIN_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} -lwebsockets -lcrypto -lyajl -lz)
{"architecture":"amd64","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/bash"],"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{"build-date":"20161102","license":"GPLv2","name":"CentOS Base Image","vendor":"CentOS"}},"container":"cdf7e99e9fd8332d199ea8ff4bde6e0ad561c3e67858b50b9b2c788fe7d70e25","container_config":{"Hostname":"cdf7e99e9fd8","Domainname":"","User":"","AttachStdin":true,"AttachStdout":true,"AttachStderr":true,"Tty":true,"OpenStdin":true,"StdinOnce":true,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/bash"],"Image":"rnd-dockerhub.huawei.com/official/centos","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{"build-date":"20161102","license":"GPLv2","name":"CentOS Base Image","vendor":"CentOS"}},"created":"2017-07-10T12:46:57.770791248Z","docker_version":"1.12.5","history":[{"created":"2016-08-30T18:18:45.109943798Z","author":"https://github.com/CentOS/sig-cloud-instance-images","created_by":"/bin/sh -c #(nop) MAINTAINER https://github.com/CentOS/sig-cloud-instance-images","empty_layer":true},{"created":"2016-11-02T19:52:05.364657474Z","author":"https://github.com/CentOS/sig-cloud-instance-images","created_by":"/bin/sh -c #(nop) ADD file:54df3580ac9fb66389b09230a74115a49ace2d193603bce0b5786dcb2957eb52 in / "},{"created":"2016-11-02T19:52:08.624010471Z","author":"https://github.com/CentOS/sig-cloud-instance-images","created_by":"/bin/sh -c #(nop) LABEL name=CentOS Base Image vendor=CentOS license=GPLv2 build-date=20161102","empty_layer":true},{"created":"2016-11-02T19:52:09.463959047Z","author":"https://github.com/CentOS/sig-cloud-instance-images","created_by":"/bin/sh -c #(nop) CMD [\"/bin/bash\"]","empty_layer":true},{"created":"2017-07-10T12:46:57.770791248Z","created_by":"/bin/bash"}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:97ca462ad9eeae25941546209454496e1d66749d53dfa2ee32bf1faabd239d38","sha256:200e885dbd78b1cbc2b5e2142b1140d49548358434d77b1312645dda482f3dcf"]}}
\ No newline at end of file
{"id":"39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10","digest":"sha256:94192fe835d92cba5513297aad1cbcb32c9af455fb575e926ee5ec683a95e586","names":["rnd-dockerhub.huawei.com/official/centos:latest"],"layer":"edd34c086208711c693a7b7a3ade23e24e6170ae24d8d2dab7c4f3efca61d509","metadata":"{}","big-data-names":["sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10","manifest"],"big-data-sizes":{"manifest":741,"sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10":2235},"big-data-digests":{"sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10":"sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10","manifest":"sha256:94192fe835d92cba5513297aad1cbcb32c9af455fb575e926ee5ec683a95e586"},"created":"2017-07-10T12:46:57.770791248Z","loaded":"2020-03-16T03:46:12.172621513Z"}
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 2235,
"digest": "sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 72143866,
"digest": "sha256:c3266e177770c798f64a4c66ad70e3f7f2808d540ea505c0dda53c954b662f83"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 87979599,
"digest": "sha256:afcd23d57ec03a7d8f4d92a6172658b353778cd523e8b0b0156186fc6df0eda2"
}
]
}
\ No newline at end of file
{"architecture":"amd64","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["sh"],"ArgsEscaped":true,"Image":"sha256:4a2b8e0900fa6a82523d5c14b646ac03c07f5f79748f63bf95ab2b069370b8f0","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"container":"bfd7fa638e592af2b731163aa6e3b58722be2bdbc62defb6114e023e8b0c288c","container_config":{"Hostname":"bfd7fa638e59","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"sh\"]"],"ArgsEscaped":true,"Image":"sha256:4a2b8e0900fa6a82523d5c14b646ac03c07f5f79748f63bf95ab2b069370b8f0","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"created":"2019-06-15T00:19:54.402459069Z","docker_version":"18.06.1-ce","history":[{"created":"2019-06-15T00:19:54.271494486Z","created_by":"/bin/sh -c #(nop) ADD file:b265aa0ea2ef7ff1f4a3e087217e75aca2c90f5c345406299664cc7969b2b28e in / "},{"created":"2019-06-15T00:19:54.402459069Z","created_by":"/bin/sh -c #(nop) CMD [\"sh\"]","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:6194458b07fcf01f1483d96cd6c34302ffff7f382bb151a6d023c4e80ba3050a"]}}
\ No newline at end of file
{"id":"e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b","digest":"sha256:64da743694ece2ca88df34bf4c5378fdfc44a1a5b50478722e2ff98b82e4a5c9","names":["rnd-dockerhub.huawei.com/official/busybox:latest"],"layer":"6194458b07fcf01f1483d96cd6c34302ffff7f382bb151a6d023c4e80ba3050a","metadata":"{}","big-data-names":["sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b","manifest"],"big-data-sizes":{"sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b":1497,"manifest":527},"big-data-digests":{"sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b":"sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b","manifest":"sha256:64da743694ece2ca88df34bf4c5378fdfc44a1a5b50478722e2ff98b82e4a5c9"},"created":"2019-06-15T00:19:54.402459069Z","loaded":"2020-03-16T03:46:17.439778957Z"}
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 1497,
"digest": "sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 740169,
"digest": "sha256:8f52abd3da461b2c0c11fda7a1b53413f1a92320eb96525ddf92c0b5cde781ad"
}
]
}
\ No newline at end of file
/******************************************************************************
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
* iSulad licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
* You may obtain a copy of Mulan PSL v1 at:
* http://license.coscl.org.cn/MulanPSL
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v1 for more details.
* Author: wujing
* Create: 2020-03-30
* Description: provide oci storage images unit test
******************************************************************************/
#include "image_store.h"
#include <iostream>
#include <algorithm>
#include <tuple>
#include <fstream>
#include <climits>
#include <gtest/gtest.h>
#include "path.h"
std::string GetDirectory()
{
char abs_path[PATH_MAX];
int ret = readlink("/proc/self/exe", abs_path, sizeof(abs_path));
if(ret < 0|| (size_t)ret >= sizeof(abs_path)) {
return "";
}
for(int i { ret }; i >= 0; --i) {
if(abs_path[i]=='/') {
abs_path[i + 1]='\0';
break;
}
}
return static_cast<std::string>(abs_path);
}
/********************************test data 1: image.json**************************************
{
"id": "39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10",
"digest": "sha256:94192fe835d92cba5513297aad1cbcb32c9af455fb575e926ee5ec683a95e586",
"names": [
"rnd-dockerhub.huawei.com/official/centos:latest"
],
"layer": "edd34c086208711c693a7b7a3ade23e24e6170ae24d8d2dab7c4f3efca61d509",
"metadata": "{}",
"big-data-names": [
"sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10",
"manifest"
],
"big-data-sizes": {
"manifest": 741,
"sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10": 2235
},
"big-data-digests": {
"sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10": "sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10",
"manifest": "sha256:94192fe835d92cba5513297aad1cbcb32c9af455fb575e926ee5ec683a95e586"
},
"created": "2017-07-10T12:46:57.770791248Z",
"Loaded": "2020-03-16T03:46:12.172621513Z"
}
******************************************************************************************/
/********************************test data 2: image.json**************************************
{
"id": "e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b",
"digest": "sha256:64da743694ece2ca88df34bf4c5378fdfc44a1a5b50478722e2ff98b82e4a5c9",
"names": [
"rnd-dockerhub.huawei.com/official/busybox:latest"
],
"layer": "6194458b07fcf01f1483d96cd6c34302ffff7f382bb151a6d023c4e80ba3050a",
"metadata": "{}",
"big-data-names": [
"sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b",
"manifest"
],
"big-data-sizes": {
"sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b": 1497,
"manifest": 527
},
"big-data-digests": {
"sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b": "sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b",
"manifest": "sha256:64da743694ece2ca88df34bf4c5378fdfc44a1a5b50478722e2ff98b82e4a5c9"
},
"created": "2019-06-15T00:19:54.402459069Z",
"Loaded": "2020-03-16T03:46:17.439778957Z"
}
******************************************************************************************/
class StorageImagesUnitTest : public testing::Test {
protected:
void SetUp() override
{
std::string dir = GetDirectory() + "/data";
ASSERT_STRNE(cleanpath(dir.c_str(), real_path, sizeof(real_path)), nullptr);
ASSERT_EQ(new_image_store(true, false, real_path, &image_store), 0);
}
void TearDown() override
{
free_image_store(image_store);
}
image_store_t *image_store {nullptr};
std::vector<std::string> ids {
"39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10",
"e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b"
};
char real_path[PATH_MAX] = {0x00};
};
TEST_F(StorageImagesUnitTest, test_images_load)
{
ASSERT_NE(image_store, nullptr);
ASSERT_STREQ(image_store->dir, real_path);
ASSERT_EQ(image_store->images_len, 2);
for (size_t i {}; i < image_store->images_len; i++) {
auto image = image_store->images[i];
ASSERT_NE(find(ids.begin(), ids.end(), std::string(image->id)), ids.end());
if (std::string(image->id) == ids.at(0)) {
ASSERT_STREQ(image->digest, "sha256:94192fe835d92cba5513297aad1cbcb32c9af455fb575e926ee5ec683a95e586");
ASSERT_EQ(image->names_len, 1);
ASSERT_STREQ(image->names[0], "rnd-dockerhub.huawei.com/official/centos:latest");
ASSERT_STREQ(image->layer, "edd34c086208711c693a7b7a3ade23e24e6170ae24d8d2dab7c4f3efca61d509");
ASSERT_STREQ(image->metadata, "{}");
ASSERT_EQ(image->big_data_names_len, 2);
ASSERT_STREQ(image->big_data_names[0], "sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10");
ASSERT_STREQ(image->big_data_names[1], "manifest");
ASSERT_EQ(image->big_data_sizes->len, 2);
ASSERT_STREQ(image->big_data_sizes->keys[0], "manifest");
ASSERT_EQ(image->big_data_sizes->values[0], 741);
ASSERT_STREQ(image->big_data_sizes->keys[1], "sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10");
ASSERT_EQ(image->big_data_sizes->values[1], 2235);
ASSERT_EQ(image->big_data_digests->len, 2);
ASSERT_STREQ(image->big_data_digests->keys[0], "sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10");
ASSERT_STREQ(image->big_data_digests->values[0], "sha256:39891ff67da98ab8540d71320915f33d2eb80ab42908e398472cab3c1ce7ac10");
ASSERT_STREQ(image->big_data_digests->keys[1], "manifest");
ASSERT_STREQ(image->big_data_digests->values[1], "sha256:94192fe835d92cba5513297aad1cbcb32c9af455fb575e926ee5ec683a95e586");
ASSERT_STREQ(image->created, "2017-07-10T12:46:57.770791248Z");
ASSERT_STREQ(image->loaded, "2020-03-16T03:46:12.172621513Z");
} else {
ASSERT_STREQ(image->digest, "sha256:64da743694ece2ca88df34bf4c5378fdfc44a1a5b50478722e2ff98b82e4a5c9");
ASSERT_EQ(image->names_len, 1);
ASSERT_STREQ(image->names[0], "rnd-dockerhub.huawei.com/official/busybox:latest");
ASSERT_STREQ(image->layer, "6194458b07fcf01f1483d96cd6c34302ffff7f382bb151a6d023c4e80ba3050a");
ASSERT_STREQ(image->metadata, "{}");
ASSERT_EQ(image->big_data_names_len, 2);
ASSERT_STREQ(image->big_data_names[0], "sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b");
ASSERT_STREQ(image->big_data_names[1], "manifest");
ASSERT_EQ(image->big_data_sizes->len, 2);
ASSERT_STREQ(image->big_data_sizes->keys[0], "sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b");
ASSERT_EQ(image->big_data_sizes->values[0], 1497);
ASSERT_STREQ(image->big_data_sizes->keys[1], "manifest");
ASSERT_EQ(image->big_data_sizes->values[1], 527);
ASSERT_EQ(image->big_data_digests->len, 2);
ASSERT_STREQ(image->big_data_digests->keys[0], "sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b");
ASSERT_STREQ(image->big_data_digests->values[0], "sha256:e4db68de4ff27c2adfea0c54bbb73a61a42f5b667c326de4d7d5b19ab71c6a3b");
ASSERT_STREQ(image->big_data_digests->keys[1], "manifest");
ASSERT_STREQ(image->big_data_digests->values[1], "sha256:64da743694ece2ca88df34bf4c5378fdfc44a1a5b50478722e2ff98b82e4a5c9");
ASSERT_STREQ(image->created, "2019-06-15T00:19:54.402459069Z");
ASSERT_STREQ(image->loaded, "2020-03-16T03:46:17.439778957Z");
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册