feat: add platform desired state manager
This commit is contained in:
@@ -84,6 +84,60 @@ tap.test('should get an identity', async () => {
|
||||
}
|
||||
});
|
||||
|
||||
tap.test('should expose platform desired state', async () => {
|
||||
const capabilitiesResponse = await testClient.platform.getPlatformCapabilities();
|
||||
expect(capabilitiesResponse.capabilities.find((capability) => capability.id === 'database')).toBeTruthy();
|
||||
|
||||
const desiredState = await testClient.platform.getPlatformDesiredState();
|
||||
expect(desiredState.capabilities).toBeTruthy();
|
||||
expect(desiredState.providerConfigs).toBeTruthy();
|
||||
expect(desiredState.bindings).toBeTruthy();
|
||||
});
|
||||
|
||||
let platformProviderConfigId: string;
|
||||
let platformBindingId: string;
|
||||
tap.test('should upsert platform provider config and binding', async () => {
|
||||
const providerConfigResponse = await testClient.platform.upsertPlatformProviderConfig({
|
||||
id: '',
|
||||
capability: 'database',
|
||||
providerType: 'docker',
|
||||
name: 'Local Docker Database',
|
||||
enabled: true,
|
||||
});
|
||||
platformProviderConfigId = providerConfigResponse.providerConfig.id;
|
||||
expect(platformProviderConfigId).toBeTruthy();
|
||||
|
||||
const bindingResponse = await testClient.platform.upsertPlatformBinding({
|
||||
id: '',
|
||||
serviceId: 'test-service',
|
||||
capability: 'database',
|
||||
desiredState: 'enabled',
|
||||
status: 'requested',
|
||||
providerConfigId: platformProviderConfigId,
|
||||
});
|
||||
platformBindingId = bindingResponse.binding.id;
|
||||
expect(platformBindingId).toBeTruthy();
|
||||
|
||||
const statusResponse = await testClient.platform.updatePlatformBindingStatus({
|
||||
bindingId: platformBindingId,
|
||||
status: 'ready',
|
||||
endpoints: [
|
||||
{
|
||||
name: 'primary',
|
||||
capability: 'database',
|
||||
protocol: 'mongodb',
|
||||
internalUrl: 'mongodb://platform-database:27017/test-service',
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(statusResponse.binding.status).toEqual('ready');
|
||||
|
||||
const bindingsResponse = await testClient.platform.getPlatformBindings({
|
||||
serviceId: 'test-service',
|
||||
});
|
||||
expect(bindingsResponse.bindings.find((binding) => binding.id === platformBindingId)).toBeTruthy();
|
||||
});
|
||||
|
||||
let image: any;
|
||||
tap.test('should create and upload an image', async () => {
|
||||
console.log('🔵 Test: Creating and uploading image...');
|
||||
|
||||
Reference in New Issue
Block a user