This repository has been archived by the owner on Apr 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
suite.clj
93 lines (85 loc) · 3.91 KB
/
suite.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
(ns katello.tests.suite
(:refer-clojure :exclude [fn])
(:require (katello.tests organizations providers promotions
sync_management login environments
systems system-groups activation-keys
users permissions e2e navigation search
distributors content-search content-views)
katello.tests.providers.custom
katello.tests.providers.redhat
[katello.client.provision :as provision]
[katello.setup :as setup]
[katello.conf :as conf :refer [config]]
[katello.login :as login]
[clojure.tools.cli :as cli]
[clj-webdriver.taxi :as browser]
[webdriver :as wd]
[serializable.fn :refer :all]
[test.tree.jenkins :as jenkins]
[test.tree.script :refer :all]
[test.tree.builder :as ttb])
(:import [org.openqa.selenium.remote SessionNotFoundException]
[org.openqa.selenium InvalidElementStateException]))
(defgroup katello-tests
katello.tests.login/login-tests
katello.tests.navigation/nav-tests
katello.tests.organizations/org-tests
katello.tests.search/search-tests
katello.tests.environments/environment-tests
katello.tests.providers/provider-tests
katello.tests.distributors/distributor-tests
katello.tests.promotions/promotion-tests
;; katello.tests.promotions/deletion-tests ;; needs to be added back
katello.tests.permissions/permission-tests
katello.tests.systems/system-tests
;;katello.tests.system-groups/sg-tests
katello.tests.activation-keys/ak-tests
katello.tests.sync_management/sync-tests
katello.tests.users/user-tests
katello.tests.e2e/end-to-end-tests
katello.tests.providers.redhat/manifest-tests
katello.tests.providers.redhat/redhat-content-provider-tests
katello.tests.providers.custom/custom-product-tests
katello.tests.content-search/content-search-tests
katello.tests.content-views/content-views-tests
)
(defgroup headpin-tests
:description "All the tests that apply to headpin or SAM."
katello.tests.login/login-tests
katello.tests.navigation/nav-tests
katello.tests.organizations/org-tests
katello.tests.search/search-tests
katello.tests.distributors/distributor-tests
katello.tests.systems/system-tests
katello.tests.system-groups/sg-tests
katello.tests.activation-keys/ak-tests
katello.tests.users/user-tests
katello.tests.providers.redhat/manifest-tests)
(defn make-suite
([] (make-suite nil))
([group]
(try (ttb/run-before (constantly true) (fn [& _] (setup/conf-selenium))
(-> group (or "katello.tests.suite/katello-tests")
symbol resolve deref))
(catch Exception e
(throw (RuntimeException.
(format "Could not find any test suite named %s. Please specify a fully qualified symbol whose value contains a test suite, eg 'katello.tests.suite/katello-tests'." group) e))))))
(defn -main [ & args]
(let [[opts [suite] banner]
(apply cli/cli args conf/options)]
(if (:help opts)
(do (println banner))
(do
(conf/init opts)
(let [client-queue (provision/init 3)]
(try (jenkins/run-suite (make-suite suite)
(merge setup/runner-config
{:threads (:num-threads opts)
:trace-depths-fn conf/trace-list
:to-trace (@conf/config :trace)
:do-not-trace (@conf/config :trace-excludes)
:middleware (setup/harness-middleware)}))
(finally (try (provision/shutdown client-queue)
(catch Exception e (.printStackTrace e))
(finally
(-> conf/*cloud-conn* :api .shutdown))))))))))