MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / AssertTempTablespaceBehavior

Function AssertTempTablespaceBehavior

tests/e2e/tablespaces_test.go:1145–1171  ·  view source on GitHub ↗
(cluster *apiv1.Cluster, expectedTempTablespaceName string)

Source from the content-addressed store, hash-verified

1143}
1144
1145func 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
1173func assertCanHibernateClusterWithTablespaces(
1174 namespace string,

Callers 1

Calls 2

GetPrimaryFunction · 0.92
QueryInInstancePodFunction · 0.92

Tested by

no test coverage detected