|
2 | 2 |
|
3 | 3 | @test "Create DB PostgreSQL" { |
4 | 4 | name='test' |
| 5 | + withResources='true' |
| 6 | + if [ "$withResources" == 'true' ]; then |
| 7 | + resources=$(cat <<EOF |
| 8 | + resources: |
| 9 | + requests: |
| 10 | + cpu: 500m |
| 11 | + memory: 768Mi |
| 12 | + limits: |
| 13 | + cpu: "1000m" |
| 14 | + memory: "1Gi" |
| 15 | +EOF |
| 16 | + ) |
| 17 | + else |
| 18 | + resources=' resources: {}' |
| 19 | + fi |
5 | 20 | kubectl -n tenant-test get postgreses.apps.cozystack.io $name || |
6 | 21 | kubectl create -f - <<EOF |
7 | 22 | apiVersion: apps.cozystack.io/v1alpha1 |
@@ -37,19 +52,15 @@ spec: |
37 | 52 | s3AccessKey: oobaiRus9pah8PhohL1ThaeTa4UVa7gu |
38 | 53 | s3SecretKey: ju3eum4dekeich9ahM1te8waeGai0oog |
39 | 54 | resticPassword: ChaXoveekoh6eigh4siesheeda2quai0 |
40 | | - resources: {} |
| 55 | + $resources |
41 | 56 | resourcesPreset: "nano" |
42 | 57 | EOF |
43 | 58 | sleep 5 |
44 | | - kubectl -n tenant-test wait hr postgres-$name --timeout=100s --for=condition=ready |
| 59 | + kubectl -n tenant-test wait hr postgres-$name --timeout=150s --for=condition=ready |
45 | 60 | kubectl -n tenant-test wait job.batch postgres-$name-init-job --timeout=50s --for=condition=Complete |
46 | 61 | timeout 40 sh -ec "until kubectl -n tenant-test get svc postgres-$name-r -o jsonpath='{.spec.ports[0].port}' | grep -q '5432'; do sleep 10; done" |
47 | 62 | timeout 40 sh -ec "until kubectl -n tenant-test get svc postgres-$name-ro -o jsonpath='{.spec.ports[0].port}' | grep -q '5432'; do sleep 10; done" |
48 | 63 | timeout 40 sh -ec "until kubectl -n tenant-test get svc postgres-$name-rw -o jsonpath='{.spec.ports[0].port}' | grep -q '5432'; do sleep 10; done" |
49 | | - timeout 120 sh -ec "until kubectl -n tenant-test get endpoints postgres-$name-r -o jsonpath='{.subsets[*].addresses[*].ip}' | grep -q '[0-9]'; do sleep 10; done" |
50 | | - # for some reason it takes longer for the read-only endpoint to be ready |
51 | | - #timeout 120 sh -ec "until kubectl -n tenant-test get endpoints postgres-$name-ro -o jsonpath='{.subsets[*].addresses[*].ip}' | grep -q '[0-9]'; do sleep 10; done" |
52 | | - timeout 120 sh -ec "until kubectl -n tenant-test get endpoints postgres-$name-rw -o jsonpath='{.subsets[*].addresses[*].ip}' | grep -q '[0-9]'; do sleep 10; done" |
53 | 64 | kubectl -n tenant-test delete postgreses.apps.cozystack.io $name |
54 | 65 | kubectl -n tenant-test delete job.batch/postgres-$name-init-job |
55 | 66 | } |
0 commit comments