-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f10cb75
commit 332cc7b
Showing
80 changed files
with
3,781 additions
and
633 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { UnstructuredList } from 'k8s-api-provider'; | ||
import { WorkloadModel } from '../../src/models'; | ||
import { ProviderPlugins } from '../../src/plugins'; | ||
import { RawDeploymentList, mockGlobalStore } from './mock'; | ||
|
||
describe('Test Plugins together', () => { | ||
ProviderPlugins.forEach(p => p.init(mockGlobalStore as any)); | ||
|
||
async function processListByPlugins(list: UnstructuredList) { | ||
let nextList = list; | ||
for (const plugin of ProviderPlugins) { | ||
nextList = await plugin.processData(nextList); | ||
} | ||
return nextList; | ||
} | ||
|
||
it('should return deployment model', async () => { | ||
const result = await processListByPlugins(RawDeploymentList as UnstructuredList); | ||
const deploymentModel = result.items[0] as WorkloadModel; | ||
expect(result.items.length).toEqual(2); | ||
expect(deploymentModel.restarts).toEqual(5); | ||
}); | ||
|
||
it('should return deployment model with relation', async () => { | ||
const result = await processListByPlugins(RawDeploymentList as UnstructuredList); | ||
const deploymentModel = result.items[0] as WorkloadModel; | ||
expect((deploymentModel.metadata as any).relations).toEqual([ | ||
{ | ||
kind: 'Pod', | ||
apiVersion: 'v1', | ||
type: 'creates', | ||
selector: { | ||
matchLabels: { | ||
'app.kubernetes.io/component': 'controller', | ||
'app.kubernetes.io/instance': 'cert-manager', | ||
'app.kubernetes.io/name': 'cert-manager', | ||
}, | ||
}, | ||
inbound: false, | ||
}, | ||
{ | ||
kind: 'Pod', | ||
apiVersion: 'v1', | ||
type: 'creates', | ||
selector: { | ||
matchLabels: { | ||
'app.kubernetes.io/component': 'controller', | ||
'app.kubernetes.io/instance': 'cert-manager', | ||
'app.kubernetes.io/name': 'cert-manager', | ||
}, | ||
}, | ||
inbound: false, | ||
}, | ||
]); | ||
}); | ||
}); |
Oops, something went wrong.