This is an automated email from the ASF dual-hosted git repository.

gfphoenix78 pushed a commit to branch sync-with-upstream
in repository https://gitbox.apache.org/repos/asf/cloudberry-gpbackup.git


The following commit(s) were added to refs/heads/sync-with-upstream by this 
push:
     new 553ced87 fix(test): Adapt role password test for Cloudberry (#20)
553ced87 is described below

commit 553ced873ee26c6e9966c91eb91c792e671e2cb3
Author: Robert Mu <[email protected]>
AuthorDate: Wed Aug 27 17:01:47 2025 +0800

    fix(test): Adapt role password test for Cloudberry (#20)
    
    The integration test for `GetDatabaseRoles` was failing on Cloudberry
    because the expected password hash format did not match the actual
    value returned by the database.
    
    The test was hard-coded to expect an MD5 password hash, but the
    Cloudberry instance uses the more secure SCRAM-SHA-256 by 
default(PostgreSQL 14).
    This resulted in a string mismatch failure.
    
    This commit adapts the test to handle this difference specifically for
    Cloudberry. When running against a Cloudberry instance, the test now:
    1. Asserts that the returned password hash has the "SCRAM-SHA-256$"
       prefix, confirming the correct algorithm is used.
    2. Clears the password fields from both the expected and actual structs
       before the final comparison, as the full salted hash is unpredictable.
    
    The test logic for all Greenplum DB versions remains unchanged, preserving
    the original MD5 hash validation for those environments.
---
 integration/metadata_globals_queries_test.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/integration/metadata_globals_queries_test.go 
b/integration/metadata_globals_queries_test.go
index 2cde136c..db3e61ac 100644
--- a/integration/metadata_globals_queries_test.go
+++ b/integration/metadata_globals_queries_test.go
@@ -344,6 +344,16 @@ CREATEEXTTABLE (protocol='gphdfs', type='writable')`
 
                        for _, role := range results {
                                if role.Name == "role1" {
+                                       if connectionPool.Version.IsCBDB() {
+                                               // Cloudberry uses 
SCRAM-SHA-256 by default, while the test was
+                                               // written expecting an MD5 
hash. The exact SCRAM hash is
+                                               // unpredictable due to 
salting, so we only check its prefix.
+                                               
Expect(role.Password).To(HavePrefix("SCRAM-SHA-256$"))
+                                               // After checking the prefix, 
we clear both password fields to prevent
+                                               // the structmatcher from 
performing a failing string comparison.
+                                               expectedRole.Password = ""
+                                               role.Password = ""
+                                       }
                                        
structmatcher.ExpectStructsToMatchExcluding(&expectedRole, role, 
"TimeConstraints.Oid")
                                        return
                                }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to