working on e2e test. fixing number mapping.
This commit is contained in:
		
							parent
							
								
									1d657f4295
								
							
						
					
					
						commit
						08e921a443
					
				| 
						 | 
					@ -926,6 +926,33 @@ class EndToEndTestCase(unittest.TestCase):
 | 
				
			||||||
        self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
 | 
					        self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
 | 
				
			||||||
        self.eventuallyTrue(lambda: k8s.check_statefulset_annotations(cluster_label, annotations), "Annotations missing")
 | 
					        self.eventuallyTrue(lambda: k8s.check_statefulset_annotations(cluster_label, annotations), "Annotations missing")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @timeout_decorator.timeout(TEST_TIMEOUT_SEC)
 | 
				
			||||||
 | 
					    @unittest.skip("Skipping this test until fixed")
 | 
				
			||||||
 | 
					    def test_zaa_test_major_version_upgrade(self):
 | 
				
			||||||
 | 
					        k8s = self.k8s
 | 
				
			||||||
 | 
					        result = k8s.create_with_kubectl("manifests/minimal-postgres-manifest-12.yaml")
 | 
				
			||||||
 | 
					        self.eventuallyEqual(lambda: k8s.count_running_pods(labels="application=spilo,cluster-name=acid-upgrade-test"), 2, "No 2 pods running")
 | 
				
			||||||
 | 
					        self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        pg_patch_version = {
 | 
				
			||||||
 | 
					            "spec": {
 | 
				
			||||||
 | 
					                "postgres": {
 | 
				
			||||||
 | 
					                    "version": "13"
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        k8s.api.custom_objects_api.patch_namespaced_custom_object(
 | 
				
			||||||
 | 
					            "acid.zalan.do", "v1", "default", "postgresqls", "acid-upgrade-test", pg_patch_version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        def check_version_13():
 | 
				
			||||||
 | 
					            p = k8s.get_patroni_state("acid-upgrade-test-0")
 | 
				
			||||||
 | 
					            version = p["server_version"][0:2]
 | 
				
			||||||
 | 
					            return version
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self.evantuallyEqual(check_version_13, "13", "Version was not upgrade to 13")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @timeout_decorator.timeout(TEST_TIMEOUT_SEC)
 | 
					    @timeout_decorator.timeout(TEST_TIMEOUT_SEC)
 | 
				
			||||||
    @unittest.skip("Skipping this test until fixed")
 | 
					    @unittest.skip("Skipping this test until fixed")
 | 
				
			||||||
    def test_zzz_taint_based_eviction(self):
 | 
					    def test_zzz_taint_based_eviction(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,6 +74,7 @@ data:
 | 
				
			||||||
  # logical_backup_s3_secret_access_key: ""
 | 
					  # logical_backup_s3_secret_access_key: ""
 | 
				
			||||||
  logical_backup_s3_sse: "AES256"
 | 
					  logical_backup_s3_sse: "AES256"
 | 
				
			||||||
  logical_backup_schedule: "30 00 * * *"
 | 
					  logical_backup_schedule: "30 00 * * *"
 | 
				
			||||||
 | 
					  major_version_upgrade_mode: "manual"
 | 
				
			||||||
  master_dns_name_format: "{cluster}.{team}.{hostedzone}"
 | 
					  master_dns_name_format: "{cluster}.{team}.{hostedzone}"
 | 
				
			||||||
  # master_pod_move_timeout: 20m
 | 
					  # master_pod_move_timeout: 20m
 | 
				
			||||||
  # max_instances: "-1"
 | 
					  # max_instances: "-1"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,21 @@
 | 
				
			||||||
 | 
					apiVersion: "acid.zalan.do/v1"
 | 
				
			||||||
 | 
					kind: postgresql
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: acid-upgrade-test
 | 
				
			||||||
 | 
					  namespace: default
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  teamId: "acid"
 | 
				
			||||||
 | 
					  volume:
 | 
				
			||||||
 | 
					    size: 1Gi
 | 
				
			||||||
 | 
					  numberOfInstances: 2
 | 
				
			||||||
 | 
					  users:
 | 
				
			||||||
 | 
					    zalando:  # database owner
 | 
				
			||||||
 | 
					    - superuser
 | 
				
			||||||
 | 
					    - createdb
 | 
				
			||||||
 | 
					    foo_user: []  # role for application foo
 | 
				
			||||||
 | 
					  databases:
 | 
				
			||||||
 | 
					    foo: zalando  # dbname: owner
 | 
				
			||||||
 | 
					  preparedDatabases:
 | 
				
			||||||
 | 
					    bar: {}
 | 
				
			||||||
 | 
					  postgresql:
 | 
				
			||||||
 | 
					    version: "12"
 | 
				
			||||||
| 
						 | 
					@ -9,12 +9,12 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// VersionMap Map of version numbers
 | 
					// VersionMap Map of version numbers
 | 
				
			||||||
var VersionMap = map[string]int{
 | 
					var VersionMap = map[string]int{
 | 
				
			||||||
	"9.5": 9500,
 | 
						"9.5": 95000,
 | 
				
			||||||
	"9.6": 9600,
 | 
						"9.6": 96000,
 | 
				
			||||||
	"10":  10000,
 | 
						"10":  100000,
 | 
				
			||||||
	"11":  11000,
 | 
						"11":  110000,
 | 
				
			||||||
	"12":  12000,
 | 
						"12":  120000,
 | 
				
			||||||
	"13":  13000,
 | 
						"13":  130000,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// IsBiggerPostgresVersion Compare two Postgres version numbers
 | 
					// IsBiggerPostgresVersion Compare two Postgres version numbers
 | 
				
			||||||
| 
						 | 
					@ -69,10 +69,10 @@ func (c *Cluster) majorVersionUpgrade() error {
 | 
				
			||||||
	numberOfPods := len(pods)
 | 
						numberOfPods := len(pods)
 | 
				
			||||||
	if allRunning && masterPod != nil {
 | 
						if allRunning && masterPod != nil {
 | 
				
			||||||
		desiredVersion := c.GetDesiredMajorVersionAsInt()
 | 
							desiredVersion := c.GetDesiredMajorVersionAsInt()
 | 
				
			||||||
		c.logger.Infof("Cluster healthy with version: %d desired: %d", c.currentMajorVersion, desiredVersion)
 | 
							c.logger.Infof("cluster healthy with version: %d desired: %d", c.currentMajorVersion, desiredVersion)
 | 
				
			||||||
		if c.currentMajorVersion < desiredVersion {
 | 
							if c.currentMajorVersion < desiredVersion {
 | 
				
			||||||
			podName := &spec.NamespacedName{Namespace: masterPod.Namespace, Name: masterPod.Name}
 | 
								podName := &spec.NamespacedName{Namespace: masterPod.Namespace, Name: masterPod.Name}
 | 
				
			||||||
			c.logger.Infof("Triggering major version upgrade on pod %s", masterPod.Name)
 | 
								c.logger.Infof("triggering major version upgrade on pod %s", masterPod.Name)
 | 
				
			||||||
			c.ExecCommand(podName, fmt.Sprintf("python3 /scripts/inplace_upgrade.py %d", numberOfPods))
 | 
								c.ExecCommand(podName, fmt.Sprintf("python3 /scripts/inplace_upgrade.py %d", numberOfPods))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue