(cluster *apiv1.Cluster, expectedTempTablespaceName string)
| 1143 | } |
| 1144 | |
| 1145 | func AssertTempTablespaceBehavior(cluster *apiv1.Cluster, expectedTempTablespaceName string) { |
| 1146 | namespace := cluster.Namespace |
| 1147 | clusterName := cluster.Name |
| 1148 | |
| 1149 | primary, err := clusterutils.GetPrimary(env.Ctx, env.Client, namespace, clusterName) |
| 1150 | if err != nil { |
| 1151 | Expect(err).ShouldNot(HaveOccurred()) |
| 1152 | } |
| 1153 | |
| 1154 | By("checking the temporary table is created into the temporary tablespace", func() { |
| 1155 | commandOutput, stdErr, err := exec.QueryInInstancePod( |
| 1156 | env.Ctx, env.Client, env.Interface, env.RestClientConfig, |
| 1157 | exec.PodLocator{ |
| 1158 | Namespace: namespace, |
| 1159 | PodName: primary.Name, |
| 1160 | }, postgres.AppDBName, |
| 1161 | "CREATE TEMPORARY TABLE cnp_e2e_test_table (i INTEGER); "+ |
| 1162 | "SELECT spcname FROM pg_catalog.pg_tablespace WHERE OID="+ |
| 1163 | "(SELECT reltablespace FROM pg_catalog.pg_class WHERE oid = 'cnp_e2e_test_table'::regclass)", |
| 1164 | ) |
| 1165 | Expect(stdErr).To(BeEmpty()) |
| 1166 | Expect(err).ShouldNot(HaveOccurred()) |
| 1167 | commandOutputLines := strings.Split(strings.Trim(commandOutput, " \n"), "\n") |
| 1168 | Expect(commandOutputLines[len(commandOutputLines)-1]).To(Equal(expectedTempTablespaceName)) |
| 1169 | GinkgoWriter.Printf("CREATE TEMPORARY ... command output was:\n%s\n", commandOutput) |
| 1170 | }) |
| 1171 | } |
| 1172 | |
| 1173 | func assertCanHibernateClusterWithTablespaces( |
| 1174 | namespace string, |
no test coverage detected