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

Function QueryInInstancePodWithTimeout

tests/utils/exec/exec.go:118–134  ·  view source on GitHub ↗

QueryInInstancePodWithTimeout executes a query in an instance pod, by connecting to the pod and the postgres container, and using a local connection with the postgres user

(
	ctx context.Context,
	crudClient client.Client,
	kubeInterface kubernetes.Interface,
	restConfig *rest.Config,
	podLocator PodLocator,
	dbname DatabaseName,
	query string,
	timeout time.Duration,
)

Source from the content-addressed store, hash-verified

116// QueryInInstancePodWithTimeout executes a query in an instance pod, by connecting to the pod
117// and the postgres container, and using a local connection with the postgres user
118func QueryInInstancePodWithTimeout(
119 ctx context.Context,
120 crudClient client.Client,
121 kubeInterface kubernetes.Interface,
122 restConfig *rest.Config,
123 podLocator PodLocator,
124 dbname DatabaseName,
125 query string,
126 timeout time.Duration,
127) (string, string, error) {
128 return CommandInInstancePod(
129 ctx, crudClient, kubeInterface, restConfig,
130 PodLocator{
131 Namespace: podLocator.Namespace,
132 PodName: podLocator.PodName,
133 }, &timeout, "psql", "-U", "postgres", string(dbname), "-tAc", query)
134}
135
136// EventuallyExecQueryInInstancePod wraps QueryInInstancePod with an Eventually clause
137func EventuallyExecQueryInInstancePod(

Callers 3

disk_space_test.goFile · 0.92
QueryInInstancePodFunction · 0.85

Calls 1

CommandInInstancePodFunction · 0.85

Tested by

no test coverage detected