MCPcopy Create free account
hub / github.com/postgres-ai/database-lab-engine / DryRun

Method DryRun

engine/internal/rdsrefresh/refresher.go:238–291  ·  view source on GitHub ↗

DryRun performs all validation steps without actually creating resources.

(ctx context.Context)

Source from the content-addressed store, hash-verified

236
237// DryRun performs all validation steps without actually creating resources.
238func (r *Refresher) DryRun(ctx context.Context) error {
239 log.Msg("=== DRY RUN MODE ===")
240
241 // check DBLab
242 log.Msg("checking DBLab Engine health...")
243
244 if err := r.dblab.Health(ctx); err != nil {
245 return fmt.Errorf("DBLab health check failed: %w", err)
246 }
247
248 log.Msg("DBLab Engine is healthy")
249
250 // check current status
251 status, err := r.dblab.GetStatus(ctx)
252
253 if err != nil {
254 return fmt.Errorf("failed to get DBLab status: %w", err)
255 }
256
257 log.Msg("DBLab retrieval status:", status.Retrieving.Status)
258
259 // check source
260 log.Msg("checking source database...")
261
262 sourceInfo, err := r.rds.GetSourceInfo(ctx)
263 if err != nil {
264 return fmt.Errorf("failed to get source info: %w", err)
265 }
266
267 log.Msg("source:", sourceInfo)
268
269 // check RDS snapshot
270 log.Msg("finding latest RDS snapshot...")
271
272 snapshotID, err := r.rds.FindLatestSnapshot(ctx)
273 if err != nil {
274 return fmt.Errorf("failed to find RDS snapshot: %w", err)
275 }
276
277 log.Msg("would use RDS snapshot:", snapshotID)
278 log.Msg("would create RDS clone with instance class:", r.cfg.RDSClone.InstanceClass)
279
280 // check parallelism
281 parallelism, err := ResolveParallelism(r.cfg)
282 if err != nil {
283 log.Warn("could not auto-detect parallelism:", err)
284 } else {
285 log.Msg("auto-parallelism: dump jobs =", parallelism.DumpJobs, ", restore jobs =", parallelism.RestoreJobs)
286 }
287
288 log.Msg("=== DRY RUN COMPLETE - all checks passed ===")
289
290 return nil
291}
292
293func (r *Refresher) writeStateFile(cloneID string, isCluster bool, sourceID string) error {
294 if r.stateFile == nil {

Callers 2

TestDryRunFunction · 0.95
runFunction · 0.80

Calls 5

ResolveParallelismFunction · 0.85
GetStatusMethod · 0.80
GetSourceInfoMethod · 0.80
FindLatestSnapshotMethod · 0.80
HealthMethod · 0.45

Tested by 1

TestDryRunFunction · 0.76