Skip to content

Commit 61aec79

Browse files
committed
dev: update provider integ tests
1 parent 850281f commit 61aec79

2 files changed

Lines changed: 61 additions & 8 deletions

File tree

test/integ/stable/core/providers/azure/lifecycle.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ describe('Azure lifecycle', () => {
7878
notificationEmail: "test@test.com"
7979
}
8080
}, {
81-
wolf: {
82-
enable: true
81+
sunshine: {
82+
enable: true,
83+
username: "sunshine",
84+
passwordBase64: Buffer.from("S3un$h1ne!").toString('base64'),
8385
},
8486
});
8587
})
@@ -105,6 +107,10 @@ describe('Azure lifecycle', () => {
105107
assert.strictEqual(instance.hardwareProfile?.vmSize, vmSize);
106108
}).timeout(30*60*1000); // 30 minutes timeout as deployment with image creation may be long
107109

110+
it('should wait for instance readiness after deployment', async () => {
111+
await waitForInstanceReadiness('deployment');
112+
}).timeout(2*60*1000);
113+
108114
it('should have resources matching state output after deployment', async () => {
109115
const azureClient = await getAzureClient();
110116
const state = await getCurrentTestState();

test/integ/stable/core/providers/linode/lifecycle.spec.ts

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ describe('Linode lifecycle', () => {
6161
baseImageSnapshot: {
6262
enable: true,
6363
},
64+
additionalLabels: ['test-label-1', 'test-label-2'],
6465
}, {
6566
sunshine: {
6667
enable: true,
@@ -115,17 +116,63 @@ describe('Linode lifecycle', () => {
115116
}
116117
}).timeout(10000)
117118

118-
it('should have a valid instance server output with existing server', async () => {
119+
it('should have a valid instance server output with existing server and additional labels applied to instance and data disk', async () => {
119120
const state = await getCurrentTestState()
121+
const linodeClient = getLinodeClient()
120122

121123
assert.ok(state.provision.output?.instanceServerId)
122124
const currentInstanceServerId = state.provision.output.instanceServerId
123125

124-
const linodeClient = getLinodeClient()
125-
126+
// Check instance server status
126127
const serverStatus = await linodeClient.getInstanceStatus(currentInstanceServerId)
127-
// Instance should be in a valid state (running, stopped, etc.)
128-
assert.equal(serverStatus, 'running')
128+
assert.equal(serverStatus, 'running', 'Instance should be running')
129+
130+
// Verify instance has correct labels
131+
const instance = await linodeClient.getLinode(currentInstanceServerId)
132+
assert.ok(instance, 'Instance should exist')
133+
134+
const expectedAdditionalLabels = ['test-label-1', 'test-label-2']
135+
const actualTags = instance.tags || []
136+
137+
// Check that all additional labels are present
138+
for (const expectedLabel of expectedAdditionalLabels) {
139+
assert.ok(
140+
actualTags.includes(expectedLabel),
141+
`Instance should have additional label '${expectedLabel}'. Actual tags: ${JSON.stringify(actualTags)}`
142+
)
143+
}
144+
145+
// Ensure there is at least one instance-name tag generated by Pulumi/linodeLabel
146+
assert.ok(
147+
actualTags.some(tag => tag.startsWith('instance-')),
148+
`Instance should have an 'instance-' tag derived from instance name. Actual tags: ${JSON.stringify(actualTags)}`
149+
)
150+
151+
// Verify data disk has correct labels
152+
assert.ok(state.provision.output?.dataDiskId, 'Data disk ID should be in output')
153+
// dataDiskId is a filesystem path basename like "scsi-0Linode_Volume_my-instance-vol"
154+
// Extract the volume label by removing the "scsi-0Linode_Volume_" prefix
155+
const volumeLabel = state.provision.output.dataDiskId.replace(/^scsi-0Linode_Volume_/, '')
156+
const volume = await linodeClient.getVolumeByLabel(volumeLabel)
157+
assert.ok(volume, 'Data volume should exist in Linode')
158+
159+
// Expected additional labels from state
160+
const volumeExpectedTags = ['test-label-1', 'test-label-2']
161+
const volumeActualTags = volume.tags || []
162+
163+
// Check that all additional labels are present
164+
for (const expectedTag of volumeExpectedTags) {
165+
assert.ok(
166+
volumeActualTags.includes(expectedTag),
167+
`Data disk should have additional label '${expectedTag}'. Actual tags: ${JSON.stringify(volumeActualTags)}`
168+
)
169+
}
170+
171+
// Ensure there is at least one instance-name tag generated by Pulumi/linodeLabel
172+
assert.ok(
173+
volumeActualTags.some(tag => tag.startsWith('instance-')),
174+
`Data disk should have an 'instance-' tag derived from instance name. Actual tags: ${JSON.stringify(volumeActualTags)}`
175+
)
129176
}).timeout(10000)
130177

131178
it('should verify instance configuration after deployment', async () => {
@@ -152,7 +199,7 @@ describe('Linode lifecycle', () => {
152199
assert.ok(dataDisk);
153200
assert.strictEqual(dataDisk.size, (dataDiskSizeGb+2) * 1024 * 1024 * 1024); // 2GB in bytes
154201

155-
}).timeout(10000)
202+
}).timeout(30*60*1000) // 30 minutes timeout, might be long
156203

157204
// run twice for idempotency
158205
for (let i = 0; i < 2; i++) {

0 commit comments

Comments
 (0)