Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/cypress/fixtures/image-digest-mirror-set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ spec:
- mirrors:
- quay.io/redhat-user-workloads/ocp-network-observab-tenant/network-observability-console-plugin-pf4-ystream
- quay.io/redhat-user-workloads/ocp-network-observab-tenant/network-observability-console-plugin-pf4-zstream
source: registry.redhat.io/network-observability/network-observability-console-plugin-compat-rhel9
source: registry.redhat.io/network-observability/network-observability-console-plugin-pf4-rhel9
153 changes: 73 additions & 80 deletions web/cypress/fixtures/test-server-client.yaml
Original file line number Diff line number Diff line change
@@ -1,94 +1,87 @@
apiVersion: template.openshift.io/v1
kind: Template
---
apiVersion: v1
kind: Namespace
metadata:
name: netobserv-test-client-server
objects:
- kind: Namespace
apiVersion: v1
metadata:
name: ${SERVER_NS}
labels:
name: ${SERVER_NS}
- apiVersion: apps/v1
kind: Deployment
name: test-server-56222
labels:
name: test-server-56222
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: test-server-56222
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
name: nginx
namespace: ${SERVER_NS}
labels:
app: nginx
spec:
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
privileged: false
image: quay.io/openshifttest/nginx-alpine:1.2.3
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
- apiVersion: v1
kind: Service
metadata:
namespace: ${SERVER_NS}
name: nginx-service
spec:
selector:
app: nginx
type: NodePort
ports:
- protocol: TCP
port: 80
targetPort: 8080
- kind: Namespace
apiVersion: v1
metadata:
name: ${CLIENT_NS}
labels:
name: ${CLIENT_NS}
- apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: client
name: client
namespace: ${CLIENT_NS}
spec:
containers:
- command:
- sh
- -c
- "
\ while : ; do\n
\ curl nginx-service.${SERVER_NS}.svc:80/data/100K 2>&1 > /dev/null ; sleep 5 \n
\ done"
image: quay.io/openshifttest/hello-openshift:1.2.0
- name: nginx
image: quay.io/openshifttest/nginx-alpine:1.2.3
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
privileged: false
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
name: client
parameters:
- name: SERVER_NS
value: test-server
- name: CLIENT_NS
value: test-client
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
namespace: test-server-56222
name: nginx-service
spec:
selector:
app: nginx
type: NodePort
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: v1
kind: Namespace
metadata:
name: test-client-56222
labels:
name: test-client-56222
---
apiVersion: v1
kind: Pod
metadata:
labels:
run: client
name: client
namespace: test-client-56222
spec:
containers:
- name: client
image: quay.io/openshifttest/hello-openshift:1.2.0
command:
- sh
- -c
- |
while : ; do
curl nginx-service.test-server-56222.svc:80/data/100K 2>&1 > /dev/null
sleep 5
done
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
21 changes: 6 additions & 15 deletions web/cypress/integration-tests/dns_tracking.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,13 @@ describe('(OCP-67087 Network_Observability) DNSTracking test', { tags: ['Network
cy.get('#search').type(dns_name + '{enter}')

// select DNS Id, DNS Error and DNS Name columns
cy.openColumnsModal()
cy.get(colSelectors.columnsModal).should('be.visible')
cy.get('#DNSId').check()
cy.get('#DNSErrNo').check()
cy.get('#DNSName').check()
cy.byTestID(colSelectors.save).click()
cy.reload()

// verify they are visible in table view
cy.byTestID('table-composable').should('exist').within(() => {
cy.get(colSelectors.dnsId).should('exist')
cy.get(colSelectors.dnsError).should('exist')
cy.get(colSelectors.dnsName).should('exist')
})
cy.selectAndVerifyColumns([
colSelectors.dnsId,
colSelectors.dnsError,
colSelectors.dnsName
])

// Verify DNSName column for all rows
// Verify DNSName value for all rows
cy.get('[data-test-td-column-id="DNSName"]').each((td) => {
expect(td).to.contain(`${dns_name}`)
})
Expand Down
16 changes: 13 additions & 3 deletions web/cypress/integration-tests/netflow_cluster_admin_group.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { netflowPage } from "@views/netflow-page"
describe('(OCP-67617 Network_Observability) User in group with cluster-admin role', { tags: ['Network_Observability'] }, function () {

before('any test', function () {
// Skip this test suite if using kubeadmin (LOGIN_IDP is 'kube:admin')
if (Cypress.env('LOGIN_IDP') === 'kube:admin') {
this.skip()
}

// create new group, add user to that group and give that group cluster-admin role
cy.adminCLI(`oc adm groups new netobservadmins`)
cy.adminCLI(`oc adm groups add-users netobservadmins ${Cypress.env('LOGIN_USERNAME')}`)
Expand All @@ -26,19 +31,24 @@ describe('(OCP-67617 Network_Observability) User in group with cluster-admin rol
cy.visit('/netflow-traffic')
// validate user is not able to access netflow traffic page
// overview shows no panels
cy.get('li.overviewTabButton').should('exist').click()
cy.get('#tabs-container').contains('Overview').click()
cy.get("#overview-flex").should('not.exist')

// table view shows no grid
cy.get('li.tableTabButton').should('exist').click()
cy.get('#tabs-container').contains('Traffic flows').click()
cy.byTestID("table-composable").should('not.exist')

// topology view shows no view
cy.get('li.topologyTabButton').should('exist').click()
cy.get('#tabs-container').contains('Topology').click()
cy.byTestID("error-state").should('exist')
})

after("all tests", function () {
// Skip cleanup if using kubeadmin
if (Cypress.env('LOGIN_IDP') === 'kube:admin') {
return
}

cy.adminCLI(`oc adm groups remove-users netobservadmins ${Cypress.env('LOGIN_USERNAME')}`)
cy.adminCLI(`oc delete groups netobservadmins`)
cy.uiLogout()
Expand Down
11 changes: 6 additions & 5 deletions web/cypress/integration-tests/netflow_external_subnet.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ describe('(OCP-67615, OCP-72874 Network_Observability) Return external traffic a
cy.byTestID("table-composable").should('exist')

// enable SrcSubnetLabel and DstSubnetLabel columns
cy.openColumnsModal()
cy.get(colSelectors.columnsModal).should('be.visible')
cy.get('#SrcSubnetLabel').check()
cy.get('#DstSubnetLabel').check()
cy.byTestID(colSelectors.save).click()
cy.selectAndVerifyColumns([
colSelectors.srcSubnetLabel,
colSelectors.dstSubnetLabel
])

// filter on SrcSubnetLabel Pods and DstIP 52.200.142.250
cy.byTestID("column-filter-toggle").click().get('.pf-c-dropdown__menu').should('be.visible')
Expand Down Expand Up @@ -64,6 +63,8 @@ describe('(OCP-67615, OCP-72874 Network_Observability) Return external traffic a
cy.byTestID("column-filter-toggle").click().get('.pf-c-dropdown__menu').should('be.visible')
cy.byTestID('group-0-toggle').click().should('be.visible')
cy.byTestID('src_namespace').click()

netflowPage.clearAllFilters()
})

afterEach("each test", function () {
Expand Down
21 changes: 9 additions & 12 deletions web/cypress/integration-tests/netflow_table.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ describe('(OCP-50532, OCP-50531, OCP-50530, OCP-59408 Network_Observability) Net
netflowPage.stopAutoRefresh()
cy.openColumnsModal()
cy.get(colSelectors.columnsModal).should('be.visible')
cy.get('#K8S_OwnerObject').check()
cy.get('#AddrPort').check()
cy.get(colSelectors.k8sOwner).check()
cy.get(colSelectors.ipPort).check()

cy.get('#Mac').should('exist').check()
cy.get('#FlowDirection').should('exist').check()
cy.get(colSelectors.mac).should('exist').check()
cy.get(colSelectors.direction).should('exist').check()
// ICMP related columns
cy.get('#IcmpType').should('exist').check()
cy.get('#IcmpCode').should('exist').check()
cy.get(colSelectors.icmpType).should('exist').check()
cy.get(colSelectors.icmpCode).should('exist').check()

// source columns
cy.get('#SrcK8S_HostIP').check()
cy.get(colSelectors.srcNodeIP).check()
cy.get('#SrcK8S_Namespace[type="checkbox"]').uncheck()

// dest columns
cy.get('#DstK8S_HostIP').check()
cy.get(colSelectors.dstNodeIP).check()

cy.byTestID(colSelectors.save).click()
cy.reload()
Expand Down Expand Up @@ -203,10 +203,7 @@ describe('(OCP-50532, OCP-50531, OCP-50530, OCP-59408 Network_Observability) Net
cy.get(displayDropdownSelectors.table).should('exist').click()
cy.byTestID('size-s').click()
cy.get(displayDropdownSelectors.table).should('exist').click()
cy.openColumnsModal()
cy.get(colSelectors.columnsModal).should('be.visible')
cy.get('#StartTime').check()
cy.byTestID(colSelectors.save).click()
cy.selectAndVerifyColumns([colSelectors.startTime])
cy.showAdvancedOptions()

cy.visit('/monitoring/alerts')
Expand Down
24 changes: 6 additions & 18 deletions web/cypress/integration-tests/netflow_zone_multiCluster.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,12 @@ describe('Netflow Zone and multiCluster test', { tags: ['Network_Observability']
cy.get('#tabs-container').contains('Traffic flows').click()
cy.byTestID("table-composable").should('exist')

cy.openColumnsModal()
cy.get(colSelectors.columnsModal).should('be.visible')
// Check zone columns
cy.get('#SrcZone').check()
cy.get('#DstZone').check()

// Check multiCluster column
cy.get('#ClusterName').check()
cy.byTestID(colSelectors.save).click()

cy.byTestID('table-composable').should('exist').within(() => {
// Verify zone column
cy.get(colSelectors.srcZone).should('exist')
cy.get(colSelectors.dstZone).should('exist')

// Verify multiCluster column
cy.get(colSelectors.clusterName).should('exist')
})
// Check zone and multiCluster columns
cy.selectAndVerifyColumns([
colSelectors.srcZone,
colSelectors.dstZone,
colSelectors.clusterName
])
})

it("(OCP-71524, aramesha, Network_Observability) should verify zone/cluster scope topology", function () {
Expand Down
16 changes: 11 additions & 5 deletions web/cypress/integration-tests/quickFilters.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,26 @@ var patch = [{
}
]
}]
var templateParams = `-p SERVER_NS=${SERVER_NS} CLIENT_NS=${CLIENT_NS}`
var templateProcessCmd = `oc process -f cypress/fixtures/test-server-client.yaml ${templateParams} --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`

describe('(OCP-56222 Network_Observability) Quick Filters test', { tags: ['Network_Observability'] }, function () {

before('any test', function () {
cy.adminCLI(`oc adm policy add-cluster-role-to-user cluster-admin ${Cypress.env('LOGIN_USERNAME')}`)
cy.uiLogin(Cypress.env('LOGIN_IDP'), Cypress.env('LOGIN_USERNAME'), Cypress.env('LOGIN_PASSWORD'))
// create test server and client pods
cy.adminCLI(`${templateProcessCmd}| oc apply -f -`)

Operator.install()
cy.checkStorageClass(this)
Operator.createFlowcollector()

// create test server and client pods
cy.adminCLI('oc apply -f cypress/fixtures/test-server-client.yaml')

// Wait for pods to be created
cy.wait(10000)

// Wait for pods to be ready
cy.adminCLI('oc wait --for=condition=Ready pod -l app=nginx -n test-server-56222 --timeout=120s')
cy.adminCLI('oc wait --for=condition=Ready pod -n test-client-56222 client --timeout=120s')
})

beforeEach('any netflow table test', function () {
Expand Down Expand Up @@ -79,7 +85,7 @@ describe('(OCP-56222 Network_Observability) Quick Filters test', { tags: ['Netwo
})

after("all tests", function () {
cy.adminCLI(`${templateProcessCmd} | oc delete -f -`)
cy.adminCLI('oc delete -f cypress/fixtures/test-server-client.yaml --ignore-not-found')
cy.adminCLI(`oc adm policy remove-cluster-role-from-user cluster-admin ${Cypress.env('LOGIN_USERNAME')}`)
})
})
11 changes: 1 addition & 10 deletions web/cypress/integration-tests/table_queryopts.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,7 @@ describe('(OCP-50532, OCP-50531, OCP-50530, OCP-59408 Network_Observability) Net

it("(OCP-68125, aramesha, Network_Observability) should verify DSCP column", function () {
netflowPage.stopAutoRefresh()
cy.openColumnsModal().then(col => {
cy.get(colSelectors.columnsModal).should('be.visible')
cy.get('#Dscp').check()
cy.byTestID(colSelectors.save).click()
})
cy.reload()

cy.byTestID('table-composable').should('exist').within(() => {
cy.get(colSelectors.dscp).should('exist')
})
cy.selectAndVerifyColumns([colSelectors.dscp])

// filter on DSCP values
cy.byTestID("column-filter-toggle").click().get('.pf-c-dropdown__menu').should('be.visible')
Expand Down
Loading
Loading