Skip to content

Commit c6caf87

Browse files
authored
Add volume TypeScript unit tests (#109)
Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
1 parent 98837c6 commit c6caf87

8 files changed

Lines changed: 4292 additions & 10 deletions

File tree

package-lock.json

Lines changed: 218 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"network_unit_test": "file:tests/ts/iaas/network",
2020
"public_ip_unit_test": "file:tests/ts/iaas/public_ip",
2121
"routing_table_unit_test": "file:tests/ts/iaas/routingTable",
22-
"securitygroup_unit_test": "file:tests/ts/iaas/securityGroup"
22+
"securitygroup_unit_test": "file:tests/ts/iaas/securityGroup",
23+
"volume_unit_test": "file:tests/ts/iaas/volume"
2324
}
2425
}

tests/ts/iaas/volume/Pulumi.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: volume_unit_test
2+
description: A minimal TypeScript Pulumi program
3+
runtime:
4+
name: nodejs
5+
options:
6+
packagemanager: npm
7+
config:
8+
pulumi:tags:
9+
value:
10+
pulumi:template: typescript

tests/ts/iaas/volume/index.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import * as pulumi from "@pulumi/pulumi";
2+
import * as stackit from "@stackitcloud/pulumi-stackit";
3+
4+
5+
export const volumeProjectId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
6+
export const volumeName = "example-volume-name";
7+
export const volumeDescription = "volume-description";
8+
export const volumeAvailabilityZone = "eu01-1";
9+
export const volumeSize = 32;
10+
export const volumePerformanceClass = "storage_premium_perf0";
11+
export const volumeLabelKey = "unit-test";
12+
export const volumeLabelValue = "test-label-value";
13+
14+
// datasource
15+
export const volumeId = "volume-id-to-read";
16+
17+
// only required fields were set
18+
export const exampleVolumeOnlyRequired = new stackit.Volume("example_volume_req", {
19+
projectId: volumeProjectId,
20+
availabilityZone: volumeAvailabilityZone,
21+
});
22+
23+
// everything is set
24+
export const exampleVolumeMax = new stackit.Volume("example_volume_max", {
25+
projectId: volumeProjectId,
26+
availabilityZone: volumeAvailabilityZone,
27+
name: volumeName,
28+
description: volumeDescription,
29+
labels: {[volumeLabelKey]:volumeLabelValue},
30+
performanceClass: volumePerformanceClass,
31+
size: volumeSize,
32+
});
33+
34+
// datasource
35+
export const volumeDatasource = stackit.getVolumeOutput({
36+
projectId: volumeProjectId,
37+
volumeId: volumeId,
38+
});

0 commit comments

Comments
 (0)