-
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.
* add gitopssets files and page * add gitops sets tests * fix fialed tests * fix tests * fix open_gitopssets_details_page test * update assertion * remove assertion * change elements locators * add more assertions * add sync step * add sync button test case * add page reload * update README file * change sync button locator * final update * add new line at the end of files * remove waiting time * remove f from gitopssets test file * remove f from policies & applications test files
- Loading branch information
1 parent
fe1dc83
commit 05bfd26
Showing
13 changed files
with
263 additions
and
42 deletions.
There are no files selected for viewing
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
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
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,30 @@ | ||
apiVersion: templates.weave.works/v1alpha1 | ||
kind: GitOpsSet | ||
metadata: | ||
labels: | ||
kustomize.toolkit.fluxcd.io/name: flux-system | ||
kustomize.toolkit.fluxcd.io/namespace: flux-system | ||
name: gitopsset-configmaps | ||
namespace: default | ||
spec: | ||
generators: | ||
- list: | ||
elements: | ||
- env: dev | ||
team: dev-team | ||
- env: production | ||
team: ops-team | ||
- env: staging | ||
team: ops-team | ||
templates: | ||
- content: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: "{{ .Element.env }}-info-configmap" | ||
namespace: default | ||
spec: | ||
data: | ||
description: This is a configmap for the {{ .Element.env }} environment | ||
env: "{{ .Element.env }}" | ||
team: "{{ .Element.team }}" |
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,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
templates.weave.works/name: gitopsset-configmaps | ||
templates.weave.works/namespace: default | ||
name: dev-info-configmap | ||
namespace: default |
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,8 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- config-map-generator.yaml | ||
- dev-info-configmap.yaml | ||
- production-info-configmap.yaml | ||
- staging-info-configmap.yaml | ||
- role.yaml |
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,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
templates.weave.works/name: gitopsset-configmaps | ||
templates.weave.works/namespace: default | ||
name: production-info-configmap | ||
namespace: default |
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,62 @@ | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: demo-role | ||
rules: | ||
- apiGroups: | ||
- kustomize.toolkit.fluxcd.io | ||
resources: | ||
- kustomizations | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: demo-role-binding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: demo-role | ||
subjects: | ||
- kind: ServiceAccount | ||
name: gitopssets-controller-manager | ||
namespace: flux-system | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: configmaps-demo-role | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- configmaps | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: configmaps-role-binding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: configmaps-demo-role | ||
subjects: | ||
- kind: ServiceAccount | ||
name: gitopssets-controller-manager | ||
namespace: flux-system |
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,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
templates.weave.works/name: gitopsset-configmaps | ||
templates.weave.works/namespace: default | ||
name: staging-info-configmap | ||
namespace: default |
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,21 @@ | ||
class GitopsSets: | ||
def __init__(self, page): | ||
self.page = page | ||
|
||
def open_gitopssets_page(self): | ||
self.page.get_by_role("link", name="GitOpsSets").click() | ||
|
||
def open_gitopssets_details_page(self): | ||
self.page.get_by_role("link", name="gitopsset-configmaps").click() | ||
|
||
def open_gitopssets_events_tab(self): | ||
self.page.get_by_role("tab", name="Events").click() | ||
|
||
def open_gitopssets_graph_tab(self): | ||
self.page.get_by_role("tab", name="Graph").click() | ||
|
||
def open_gitopssets_yaml_tab(self): | ||
self.page.get_by_role("tab", name="Yaml").click() | ||
|
||
def back_to_gitopssets_list(self): | ||
self.page.get_by_test_id("link-GitOpsSet").click() |
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
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,52 @@ | ||
import os | ||
|
||
from playwright.sync_api import Playwright, sync_playwright, expect | ||
from pages.gitopssets_page import GitopsSets | ||
import pytest | ||
|
||
|
||
@pytest.mark.usefixtures("login") | ||
class TestGitopsSets: | ||
@pytest.fixture(autouse=True) | ||
def _create_obj(self, login): | ||
self.page = login | ||
self.gitopssets_page = GitopsSets(self.page) | ||
self.URL = os.getenv("URL") | ||
|
||
def test_open_gitopssets_page(self): | ||
self.gitopssets_page.open_gitopssets_page() | ||
expect(self.page).to_have_url(f"{self.URL}/gitopssets") | ||
|
||
def test_open_gitopssets_details_page(self): | ||
self.gitopssets_page.open_gitopssets_details_page() | ||
expect(self.page).to_have_url(f"{self.URL}/gitopssets/object/details?" | ||
"clusterName=management" | ||
"&name=gitopsset-configmaps" | ||
"&namespace=default") | ||
|
||
def test_open_gitopssets_events_tab(self): | ||
self.gitopssets_page.open_gitopssets_events_tab() | ||
expect(self.page).to_have_url(f"{self.URL}/gitopssets/object/events?" | ||
"clusterName=management" | ||
"&name=gitopsset-configmaps" | ||
"&namespace=default") | ||
|
||
def test_open_gitopssets_graph_tab(self): | ||
self.gitopssets_page.open_gitopssets_graph_tab() | ||
expect(self.page).to_have_url(f"{self.URL}/gitopssets/object/graph?" | ||
"clusterName=management" | ||
"&name=gitopsset-configmaps" | ||
"&namespace=default") | ||
|
||
def test_open_gitopssets_yaml_tab(self): | ||
self.gitopssets_page.open_gitopssets_yaml_tab() | ||
expect(self.page).to_have_url(f"{self.URL}/gitopssets/object/yaml?" | ||
"clusterName=management" | ||
"&name=gitopsset-configmaps" | ||
"&namespace=default") | ||
expect(self.page.get_by_text("kubectl get gitopsset gitopsset-configmaps -n default -o yaml")).to_be_visible() | ||
|
||
def test_back_to_gitopssets_list(self): | ||
self.gitopssets_page.back_to_gitopssets_list() | ||
expect(self.page).to_have_url(f"{self.URL}/gitopssets") | ||
expect(self.page.locator("tbody")).to_contain_text("gitopsset-configmaps") |
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,26 @@ | ||
import os | ||
|
||
from playwright.sync_api import Playwright, sync_playwright, expect | ||
from pages.policies_page import Policies | ||
import pytest | ||
|
||
|
||
@pytest.mark.usefixtures("login") | ||
class TestPolicies: | ||
|
||
@pytest.fixture(autouse=True) | ||
def _obj(self, login): | ||
self.page = login | ||
self.policies_page = Policies(self.page) | ||
self.URL = os.getenv("URL") | ||
|
||
def test_open_policies_page(self): | ||
self.policies_page.open_policies_page() | ||
expect(self.page).to_have_url(f"{self.URL}/policies/list") | ||
|
||
def test_open_policy_details_page(self): | ||
self.policies_page.open_policy_details_page() | ||
expect(self.page).to_have_url(f"{self.URL}/policy_details/" | ||
"details?clusterName=management" | ||
"&id=weave.policies.containers-minimum-replica-count" | ||
"&name=Containers%20Minimum%20Replica%20Count") |
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,15 @@ | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1 | ||
kind: Kustomization | ||
metadata: | ||
name: gitopsset-configmaps | ||
namespace: default | ||
spec: | ||
interval: 10m | ||
targetNamespace: default | ||
sourceRef: | ||
kind: GitRepository | ||
name: flux-system | ||
namespace: flux-system | ||
path: ./gitops-sets | ||
prune: true | ||
timeout: 1m |