feat(cloudly): add service runtime and onboarding
This commit is contained in:
@@ -92,6 +92,58 @@ tap.test('should get an identity', async () => {
|
||||
}
|
||||
});
|
||||
|
||||
tap.test('should create and consume node jump codes', async () => {
|
||||
const cluster = await testClient.cluster.createCluster('Jump Code Test Cluster');
|
||||
const createJumpCommandTR = testClient.typedsocketClient.createTypedRequest<any>('createNodeJumpCommand');
|
||||
const jumpCommand = await createJumpCommandTR.fire({
|
||||
identity: testClient.identity,
|
||||
clusterId: cluster.id,
|
||||
});
|
||||
|
||||
expect(jumpCommand.jumpUrl.includes('/jump/')).toBeTrue();
|
||||
expect(jumpCommand.command.includes(jumpCommand.jumpUrl)).toBeTrue();
|
||||
|
||||
const setupResponse = await fetch(jumpCommand.jumpUrl, {
|
||||
headers: {
|
||||
accept: '*/*',
|
||||
'user-agent': 'curl/8.0',
|
||||
},
|
||||
});
|
||||
const setupScript = await setupResponse.text();
|
||||
expect(setupResponse.status).toEqual(200);
|
||||
expect(setupScript.includes('spark installdaemon --mode=coreflow-node')).toBeTrue();
|
||||
|
||||
const claimResponse = await fetch(
|
||||
`http://${helpers.testCloudlyConfig.publicUrl}:${helpers.testCloudlyConfig.publicPort}/jump/v1/claim`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ jumpCode: jumpCommand.jumpCode, hostname: 'jump-code-test-node' }),
|
||||
},
|
||||
);
|
||||
const claimBody = await claimResponse.json();
|
||||
expect(claimResponse.status).toEqual(200);
|
||||
expect(claimBody.accepted).toBeTrue();
|
||||
expect(claimBody.nodeId).toBeTruthy();
|
||||
expect(claimBody.coreflowJumpCode).toBeTruthy();
|
||||
|
||||
const secondClaimResponse = await fetch(
|
||||
`http://${helpers.testCloudlyConfig.publicUrl}:${helpers.testCloudlyConfig.publicPort}/jump/v1/claim`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ jumpCode: jumpCommand.jumpCode }),
|
||||
},
|
||||
);
|
||||
const secondClaimBody = await secondClaimResponse.json();
|
||||
expect(secondClaimResponse.status).toEqual(400);
|
||||
expect(secondClaimBody.accepted).toBeFalse();
|
||||
});
|
||||
|
||||
tap.test('should expose the OCI registry endpoint', async () => {
|
||||
const response = await fetch(
|
||||
`http://${helpers.testCloudlyConfig.publicUrl}:${helpers.testCloudlyConfig.publicPort}/v2/`,
|
||||
|
||||
Reference in New Issue
Block a user