-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.test.yaml
More file actions
190 lines (168 loc) · 5.49 KB
/
Taskfile.test.yaml
File metadata and controls
190 lines (168 loc) · 5.49 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
version: "3"
# GitHub Actions output grouping
output:
group:
begin: "::group::{{.TASK}}"
end: "::endgroup::"
vars:
TEST_DIR: ./test
GO_TEST_FLAGS: -v -timeout 30m
POSTGRES_IMAGE: flanksource/postgres:test
KIND_CLUSTER_NAME: postgres-ct-test
KIND_KUBECONFIG: /tmp/postgres-ct-kubeconfig
tasks:
# Docker image testing tasks
test-image:
desc: Build Docker image and run integration tests
deps: [build]
dir: "{{.TEST_DIR}}"
cmds:
- |
echo "🧪 Running Docker image integration tests..."
go test {{.GO_TEST_FLAGS}} -run TestPostgresIntegration
# Integration testing tasks
test-integration:
desc: Run comprehensive integration tests
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "🧪 Running comprehensive integration tests..."
go test {{.GO_TEST_FLAGS}} -run TestPostgresIntegration
test-extensions:
desc: Test all PostgreSQL extensions functionality
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "🧩 Testing PostgreSQL extensions..."
go test {{.GO_TEST_FLAGS}} -run "TestPostgresIntegration.*extension"
test-services:
desc: Test all integrated services (PgBouncer, PostgREST, WAL-G)
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "⚙️ Testing integrated services..."
go test {{.GO_TEST_FLAGS}} -run "TestPostgresIntegration.*(PgBouncer|PostgREST|WAL)"
test-enhanced:
desc: Run enhanced integration tests (Kubernetes-based)
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "🚀 Running enhanced integration tests..."
go test {{.GO_TEST_FLAGS}} -run TestEnhanced
# Main test tasks using Go tests
all:
desc: Run all PostgreSQL tests (upgrades, integration, extensions)
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "🧪 Running all PostgreSQL tests..."
go test {{.GO_TEST_FLAGS}} -run TestPostgresUpgrade
go test {{.GO_TEST_FLAGS}} -run TestPostgresIntegration
go test {{.GO_TEST_FLAGS}} -run TestEnhanced
all-upgrades:
desc: Run all PostgreSQL upgrade tests only
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "🧪 Running all PostgreSQL upgrade tests..."
go test {{.GO_TEST_FLAGS}} -run TestPostgresUpgrade
all-features:
desc: Run all feature tests (extensions, services, integrations)
deps: [test-integration, test-extensions, test-services, test-enhanced]
cmds:
- echo "✅ All feature tests completed"
upgrade-14-to-17:
desc: Test upgrade from PostgreSQL 14 to 17
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "🧪 Testing upgrade from PostgreSQL 14 to 17..."
go test {{.GO_TEST_FLAGS}} -run "TestPostgresUpgrade/Upgrade_14_to_17"
upgrade-15-to-17:
desc: Test upgrade from PostgreSQL 15 to 17
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "🧪 Testing upgrade from PostgreSQL 15 to 17..."
go test {{.GO_TEST_FLAGS}} -run "TestPostgresUpgrade/Upgrade_15_to_17"
upgrade-16-to-17:
desc: Test upgrade from PostgreSQL 16 to 17
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "🧪 Testing upgrade from PostgreSQL 16 to 17..."
go test {{.GO_TEST_FLAGS}} -run "TestPostgresUpgrade/Upgrade_16_to_17"
upgrade-14-to-16:
desc: Test upgrade from PostgreSQL 14 to 16
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "🧪 Testing upgrade from PostgreSQL 14 to 16..."
go test {{.GO_TEST_FLAGS}} -run "TestPostgresUpgrade/Upgrade_14_to_16"
upgrade-15-to-16:
desc: Test upgrade from PostgreSQL 15 to 16
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "🧪 Testing upgrade from PostgreSQL 15 to 16..."
go test {{.GO_TEST_FLAGS}} -run "TestPostgresUpgrade/Upgrade_15_to_16"
# Quick test for development
quick:
desc: Quick development test (14 to 17 upgrade only)
dir: "{{.TEST_DIR}}"
deps: [build]
cmds:
- |
echo "⚡ Running quick test..."
go test {{.GO_TEST_FLAGS}} -run TestPostgresUpgradeQuick
# Build task
build:
desc: Build the flanksource/postgres Docker image
cmds:
- task build:build
# Status task using Go test
status:
desc: Show status of volumes and images
dir: "{{.TEST_DIR}}"
cmds:
- |
echo "📊 Checking Docker resources status..."
go test {{.GO_TEST_FLAGS}} -run TestShowUpgradeStatus
clean:
desc: Clean up test resources and Docker volumes
cmds:
- |
echo "🧹 Cleaning up test resources..."
docker stop postgres-integration-test postgres-upgrade-test || true
docker rm postgres-integration-test postgres-upgrade-test || true
docker volume prune -f --filter label=cleanup=test || true
docker system prune -f || true
echo "✅ Cleanup completed"
# Helm E2E testing tasks
helm:e2e:
desc: Run end-to-end Helm chart tests with kind cluster
deps: [build]
dir: test
cmds:
- go test -v ./helm
helm:e2e:clean:
desc: Delete the kind cluster used for helm e2e tests
cmds:
- |
CLUSTER_NAME="{{.KIND_CLUSTER_NAME}}"
KUBECONFIG_PATH="{{.KIND_KUBECONFIG}}"
echo "🧹 Cleaning up kind cluster: $CLUSTER_NAME..."
kind delete cluster --name "$CLUSTER_NAME" 2>/dev/null || echo "Cluster already deleted"
rm -f "$KUBECONFIG_PATH" 2>/dev/null || true
echo "✅ Cleanup complete"