Skip to content

Commit

Permalink
[fix](test) fix unstable lower case test (apache#46410)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

when "use_meta_cache" = "false", the meta sync between FEs maybe delay,
and it may cause the case unstable, so I added a `wait()` method to wait
the meta sync.
  • Loading branch information
morningman authored Jan 4, 2025
1 parent 7c1b3a7 commit fe8a334
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
// specific language governing permissions and limitations
// under the License.

import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import org.awaitility.Awaitility

suite("test_lower_case_meta_show_and_select", "p0,external,doris,external_docker,external_docker_doris") {

String jdbcUrl = context.config.jdbcUrl
Expand All @@ -24,6 +28,18 @@ suite("test_lower_case_meta_show_and_select", "p0,external,doris,external_docker
String bucket = getS3BucketName()
String driver_url = "https://${bucket}.${s3_endpoint}/regression/jdbc_driver/mysql-connector-j-8.3.0.jar"

def wait_table_sync = { String db ->
Awaitility.await().atMost(10, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until{
try {
def res = sql "show tables from ${db}"
return res.size() > 0;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}

try_sql """drop user ${jdbcUser}"""
sql """create user ${jdbcUser} identified by '${jdbcPassword}'"""
sql """grant all on *.*.* to ${jdbcUser}"""
Expand Down Expand Up @@ -75,6 +91,7 @@ suite("test_lower_case_meta_show_and_select", "p0,external,doris,external_docker
"include_database_list" = "external_test_lower,external_test_UPPER"
)"""

wait_table_sync("test_cache_false_lower_false.external_test_lower")
test {
sql """show databases from test_cache_false_lower_false"""

Expand Down Expand Up @@ -172,6 +189,7 @@ suite("test_lower_case_meta_show_and_select", "p0,external,doris,external_docker
"include_database_list" = "external_test_lower,external_test_UPPER"
)"""

wait_table_sync("test_cache_false_lower_true.external_test_lower")
test {
sql """show databases from test_cache_false_lower_true"""

Expand Down
Loading

0 comments on commit fe8a334

Please sign in to comment.