Skip to content

Conversation

@robertmu
Copy link
Contributor

@robertmu robertmu commented Oct 15, 2025

If the BeforeSuite hook fails before the database connection is initialized, the connectionPool variable remains nil. A common cause is a misconfigured test environment, such as when greenplum_path.sh is not sourced, leading to a "command not found" error for createdb.

The previous AfterSuite logic would then attempt to dereference this nil pointer, causing a panic.

Running Suite: database query tests - /home/cbdb/Projects/gpbackup/integration
==============================================================================
Random Seed: 1760521199 - will randomize all specs

Will run 549 of 552 specs
------------------------------
[BeforeSuite] [FAILED] [0.003 seconds]
[BeforeSuite]
/home/cbdb/Projects/gpbackup/integration/integration_suite_test.go:54

  [FAILED] Cannot create database testdb; is GPDB running?
  In [BeforeSuite] at: /home/cbdb/Projects/gpbackup/integration/integration_suite_test.go:58 @ 10/15/25 17:40:06.839
------------------------------
[AfterSuite] [PANICKED] [0.000 seconds]
[AfterSuite]
/home/cbdb/Projects/gpbackup/integration/integration_suite_test.go:127

  [PANICKED] Test Panicked
  In [AfterSuite] at: /usr/lib/go-1.23/src/runtime/panic.go:262 @ 10/15/25 17:40:06.839

  runtime error: invalid memory address or nil pointer dereference

  Full Stack Trace
    github.com/apache/cloudberry-backup/integration.init.func10()
    	/home/cbdb/Projects/gpbackup/integration/integration_suite_test.go:129 +0x26
------------------------------

Summarizing 2 Failures:
  [FAIL] [BeforeSuite]
  /home/cbdb/Projects/gpbackup/integration/integration_suite_test.go:58
  [PANICKED!] [AfterSuite]
  /usr/lib/go-1.23/src/runtime/panic.go:262

Ran 0 of 552 Specs in 0.023 seconds
FAIL! -- A BeforeSuite node failed so all tests were skipped.
--- FAIL: TestQueries (0.03s)
FAIL

Ginkgo ran 1 suite in 7.163251311s

If the BeforeSuite hook fails before the database connection is
initialized, the `connectionPool` variable remains nil. A common cause
is a misconfigured test environment, such as when `greenplum_path.sh`
is not sourced, leading to a "command not found" error for `createdb`.

The previous AfterSuite logic would then attempt to dereference this
nil pointer, causing a panic.

```
Running Suite: database query tests - /home/cbdb/Projects/gpbackup/integration
==============================================================================
Random Seed: 1760521199 - will randomize all specs

Will run 549 of 552 specs
------------------------------
[BeforeSuite] [FAILED] [0.003 seconds]
[BeforeSuite]
/home/cbdb/Projects/gpbackup/integration/integration_suite_test.go:54

  [FAILED] Cannot create database testdb; is GPDB running?
  In [BeforeSuite] at: /home/cbdb/Projects/gpbackup/integration/integration_suite_test.go:58 @ 10/15/25 17:40:06.839
------------------------------
[AfterSuite] [PANICKED] [0.000 seconds]
[AfterSuite]
/home/cbdb/Projects/gpbackup/integration/integration_suite_test.go:127

  [PANICKED] Test Panicked
  In [AfterSuite] at: /usr/lib/go-1.23/src/runtime/panic.go:262 @ 10/15/25 17:40:06.839

  runtime error: invalid memory address or nil pointer dereference

  Full Stack Trace
    github.com/apache/cloudberry-backup/integration.init.func10()
    	/home/cbdb/Projects/gpbackup/integration/integration_suite_test.go:129 +0x26
------------------------------

Summarizing 2 Failures:
  [FAIL] [BeforeSuite]
  /home/cbdb/Projects/gpbackup/integration/integration_suite_test.go:58
  [PANICKED!] [AfterSuite]
  /usr/lib/go-1.23/src/runtime/panic.go:262

Ran 0 of 552 Specs in 0.023 seconds
FAIL! -- A BeforeSuite node failed so all tests were skipped.
--- FAIL: TestQueries (0.03s)
FAIL

Ginkgo ran 1 suite in 7.163251311s
```
@my-ship-it my-ship-it merged commit 4648d84 into apache:main Oct 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants