mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
test: virstoragetest: Add testing of network disk details
To be able to fully test parsing of networked storage strings we need to add a few fields for: hostname, protocol and auth string.
This commit is contained in:
parent
33b282eadc
commit
e650f30b93
@ -279,6 +279,9 @@ struct _testFileData
|
|||||||
const char *path;
|
const char *path;
|
||||||
int type;
|
int type;
|
||||||
int format;
|
int format;
|
||||||
|
const char *secret;
|
||||||
|
const char *hostname;
|
||||||
|
int protocol;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -306,7 +309,10 @@ static const char testStorageChainFormat[] =
|
|||||||
"encryption: %d\n"
|
"encryption: %d\n"
|
||||||
"relPath:%s\n"
|
"relPath:%s\n"
|
||||||
"type:%d\n"
|
"type:%d\n"
|
||||||
"format:%d\n";
|
"format:%d\n"
|
||||||
|
"protocol:%s\n"
|
||||||
|
"hostname:%s\n"
|
||||||
|
"secret:%s\n";
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testStorageChain(const void *args)
|
testStorageChain(const void *args)
|
||||||
@ -369,7 +375,10 @@ testStorageChain(const void *args)
|
|||||||
data->files[i]->expEncrypted,
|
data->files[i]->expEncrypted,
|
||||||
NULLSTR(data->files[i]->pathRel),
|
NULLSTR(data->files[i]->pathRel),
|
||||||
data->files[i]->type,
|
data->files[i]->type,
|
||||||
data->files[i]->format) < 0 ||
|
data->files[i]->format,
|
||||||
|
virStorageNetProtocolTypeToString(data->files[i]->protocol),
|
||||||
|
NULLSTR(data->files[i]->hostname),
|
||||||
|
NULLSTR(data->files[i]->secret)) < 0 ||
|
||||||
virAsprintf(&actual,
|
virAsprintf(&actual,
|
||||||
testStorageChainFormat, i,
|
testStorageChainFormat, i,
|
||||||
NULLSTR(elt->path),
|
NULLSTR(elt->path),
|
||||||
@ -378,7 +387,10 @@ testStorageChain(const void *args)
|
|||||||
!!elt->encryption,
|
!!elt->encryption,
|
||||||
NULLSTR(elt->relPath),
|
NULLSTR(elt->relPath),
|
||||||
elt->type,
|
elt->type,
|
||||||
elt->format) < 0) {
|
elt->format,
|
||||||
|
virStorageNetProtocolTypeToString(elt->protocol),
|
||||||
|
NULLSTR(elt->nhosts ? elt->hosts[0].name : NULL),
|
||||||
|
NULLSTR(elt->auth ? elt->auth->username : NULL)) < 0) {
|
||||||
VIR_FREE(expect);
|
VIR_FREE(expect);
|
||||||
VIR_FREE(actual);
|
VIR_FREE(actual);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -830,6 +842,8 @@ mymain(void)
|
|||||||
.path = "blah",
|
.path = "blah",
|
||||||
.type = VIR_STORAGE_TYPE_NETWORK,
|
.type = VIR_STORAGE_TYPE_NETWORK,
|
||||||
.format = VIR_STORAGE_FILE_RAW,
|
.format = VIR_STORAGE_FILE_RAW,
|
||||||
|
.protocol = VIR_STORAGE_NET_PROTOCOL_NBD,
|
||||||
|
.hostname = "example.org",
|
||||||
};
|
};
|
||||||
TEST_CHAIN(11, absqcow2, VIR_STORAGE_FILE_QCOW2,
|
TEST_CHAIN(11, absqcow2, VIR_STORAGE_FILE_QCOW2,
|
||||||
(&qcow2, &nbd), EXP_PASS,
|
(&qcow2, &nbd), EXP_PASS,
|
||||||
@ -849,6 +863,8 @@ mymain(void)
|
|||||||
.path = "blah",
|
.path = "blah",
|
||||||
.type = VIR_STORAGE_TYPE_NETWORK,
|
.type = VIR_STORAGE_TYPE_NETWORK,
|
||||||
.format = VIR_STORAGE_FILE_RAW,
|
.format = VIR_STORAGE_FILE_RAW,
|
||||||
|
.protocol = VIR_STORAGE_NET_PROTOCOL_NBD,
|
||||||
|
.hostname = "example.org",
|
||||||
};
|
};
|
||||||
TEST_CHAIN(12, absqcow2, VIR_STORAGE_FILE_QCOW2,
|
TEST_CHAIN(12, absqcow2, VIR_STORAGE_FILE_QCOW2,
|
||||||
(&qcow2, &nbd2), EXP_PASS,
|
(&qcow2, &nbd2), EXP_PASS,
|
||||||
|
Loading…
Reference in New Issue
Block a user