Commit b7826f7c authored by Alexander Turinske's avatar Alexander Turinske

Fix editing predefined container policies

- add `__typename` and `kind` to predefined container policy objects
- update tests
parent de200ba4
......@@ -6,8 +6,10 @@ export const INVALID_CURRENT_ENVIRONMENT_NAME = '–';
export const PREDEFINED_NETWORK_POLICIES = [
{
__typename: 'NetworkPolicy',
name: 'drop-outbound',
enabled: false,
kind: 'CiliumNetworkPolicy',
yaml: `---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
......@@ -19,8 +21,10 @@ spec:
- {}`,
},
{
__typename: 'NetworkPolicy',
name: 'allow-inbound-http',
enabled: false,
kind: 'CiliumNetworkPolicy',
yaml: `---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
......
......@@ -5,6 +5,7 @@ import VueApollo from 'vue-apollo';
import { POLICY_TYPE_OPTIONS } from 'ee/threat_monitoring/components/constants';
import PoliciesList from 'ee/threat_monitoring/components/policies/policies_list.vue';
import PolicyDrawer from 'ee/threat_monitoring/components/policy_drawer/policy_drawer.vue';
import { PREDEFINED_NETWORK_POLICIES } from 'ee/threat_monitoring/constants';
import networkPoliciesQuery from 'ee/threat_monitoring/graphql/queries/network_policies.query.graphql';
import scanExecutionPoliciesQuery from 'ee/threat_monitoring/graphql/queries/scan_execution_policies.query.graphql';
import createStore from 'ee/threat_monitoring/store';
......@@ -190,8 +191,8 @@ describe('PoliciesList component', () => {
rowIndex | expectedPolicyName | expectedPolicyType
${1} | ${mockScanExecutionPoliciesResponse[0].name} | ${'Scan execution'}
${3} | ${mockNetworkPoliciesResponse[0].name} | ${'Network'}
${4} | ${'drop-outbound'} | ${'Network'}
${5} | ${'allow-inbound-http'} | ${'Network'}
${4} | ${PREDEFINED_NETWORK_POLICIES[0].name} | ${'Network'}
${5} | ${PREDEFINED_NETWORK_POLICIES[1].name} | ${'Network'}
`('policy in row #$rowIndex', ({ rowIndex, expectedPolicyName, expectedPolicyType }) => {
let row;
......@@ -280,6 +281,8 @@ describe('PoliciesList component', () => {
description | policy | policyType | editPolicyPath
${'network'} | ${mockNetworkPoliciesResponse[0]} | ${'container'} | ${'path/to/policy?environment_id=2&type=container_policy&kind=NetworkPolicy'}
${'container'} | ${mockNetworkPoliciesResponse[1]} | ${'container'} | ${'path/to/policy?environment_id=2&type=container_policy&kind=CiliumNetworkPolicy'}
${PREDEFINED_NETWORK_POLICIES[0].name} | ${PREDEFINED_NETWORK_POLICIES[0]} | ${'container'} | ${'path/to/policy?environment_id=2&type=container_policy&kind=CiliumNetworkPolicy'}
${PREDEFINED_NETWORK_POLICIES[1].name} | ${PREDEFINED_NETWORK_POLICIES[1]} | ${'container'} | ${'path/to/policy?environment_id=2&type=container_policy&kind=CiliumNetworkPolicy'}
${'scan execution'} | ${mockScanExecutionPoliciesResponse[0]} | ${'scanExecution'} | ${'path/to/policy?environment_id=2&type=scan_execution_policy'}
`('given there is a $description policy selected', ({ policy, policyType, editPolicyPath }) => {
beforeEach(() => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment