Skip to content

Commit 22fa64b

Browse files
committed
deleve pvc
1 parent 392b409 commit 22fa64b

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

scalardb/src/scalardb/db/cluster.clj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,11 @@
190190
:cluster-cassandra :cassandra-scalardb-cluster))
191191
(catch Exception _))
192192
(try
193-
(c/exec :kubectl :delete
194-
:pvc :-l "app.kubernetes.io/instance=postgresql-scalardb-cluster")
193+
(c/exec :kubectl :delete :pvc :-l
194+
(str "app.kubernetes.io/instance="
195+
(case (:db-type test)
196+
:cluster "postgresql-scalardb-cluster"
197+
:cluster-cassandra "cassandra-scalardb-cluster")))
195198
(catch Exception _))
196199
(try
197200
(c/exec :helm :uninstall :scalardb-cluster)

scalardb/src/scalardb/nemesis/cluster.clj

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
(def ^:private ^:const PARTITION_YAML "./partition.yaml")
1616
(def ^:private ^:const PACKET_FAULT_YAML "./packet-fault.yaml")
1717

18+
(def ^:private ^:const MAX_FAULT_POD_NUM 3)
19+
1820
(defn- time-fault-yaml
1921
[pod-name]
2022
(str "./time-fault-" pod-name ".yaml"))
@@ -37,12 +39,8 @@
3739
(if (contains? #{:pause :kill} pod-fault)
3840
(binding [c/*dir* (System/getProperty "user.dir")]
3941
(let [targets (->> (get-pod-list)
40-
;; choose envoy or cluster nodes
41-
;(filter #(str/starts-with? % "scalardb-"))
42-
;; TODO: test failed when killing a postgres pod
43-
(filter #(str/starts-with? % "postgresql-"))
4442
shuffle
45-
(take (inc (rand-int 3))))
43+
(take (inc (rand-int MAX_FAULT_POD_NUM))))
4644
action (case pod-fault
4745
:pause "pod-failure"
4846
:kill "pod-kill")
@@ -196,7 +194,7 @@
196194
:start (c/on (-> test :nodes first)
197195
(let [grudge (->> (get-pod-list)
198196
shuffle
199-
(take (inc (rand-int 3))))]
197+
(take (inc (rand-int MAX_FAULT_POD_NUM))))]
200198
(apply-partition-exp grudge)
201199
(assoc op :value [:isolated grudge])))
202200
:stop (do (c/on (-> test :nodes first) (delete-partition-exp))
@@ -274,7 +272,7 @@
274272
(->> (c/on (-> test :nodes first)
275273
(get-cluster-node-pods))
276274
shuffle
277-
(take (inc (rand-int 3)))))
275+
(take (inc (rand-int MAX_FAULT_POD_NUM)))))
278276
clock-gen (gen/mix [(nt/reset-gen-select target-select)
279277
(nt/bump-gen-select target-select)])
280278
gen (->> clock-gen

0 commit comments

Comments
 (0)