Code review comment: The should be configured in Flink config.yaml file? The refresh batch job need to depend on file catalog store to get find materialized table when scheduler open a new session to trigger refresh operation.

Code under review:
public void testMaterializedTableInFullMode() throws Exception {
        Duration fullModeWaitTime = Duration.ofMinutes(5);
        Duration fullModeWaitPause = Duration.ofSeconds(10);

        
        try (GatewayController gateway = flinkResource.startSqlGateway();
                ClusterController ignore = flinkResource.startCluster(4)) {

            File catalogStoreFolder = FOLDER.newFolder("catalog-store");
            Map<String, String> sessionProperties = new HashMap<>();
            sessionProperties.put("table.catalog-store.kind", "file");
            sessionProperties.put(
                    "table.catalog-store.file.path", catalogStoreFolder.getAbsolutePath());
            sessionProperties.put("workflow-scheduler.type", "embedded");

            FlinkDistribution.TestSqlGatewayRestClient gatewayRestClient =
                    new FlinkDistribution.TestSqlGatewayRestClient(
                            InetAddress.getByName("localhost").getHostAddress(),
                            restPort.getPort(),
                            SqlGatewayRestAPIVersion.getDefaultVersion().toString().toLowerCase(),
                            sessionProperties);

            File catalogFolder = FOLDER.newFolder("filesystem-catalog");
            FOLDER.newFolder("filesystem-catalog/test_db");
            String createCatalogDDL =
                    String.format(
                            "CREATE CATALOG test_catalog WITH (\n"
                                    + "  'type' = 'test-filesystem',\n"
                                    + "  'default-database' = 'test_db',\n"
                                    + "  'path' = '%s'\n"
                                    + ")",
                            catalogFolder.getAbsolutePath());
            gatewayRestClient.executeStatementWithResult(createCatalogDDL);
            gatewayRestClient.executeStatementWithResult("USE CATALOG test_catalog");

            File filesystemSourceFolder = FOLDER.newFolder("filesystem-source");

            gatewayRestClient.executeStatementWithResult(
                    String.format(
                            "CREATE TABLE batch_source (\n"
                                    + "    `timestamp` TIMESTAMP(3),\n"
                                    + "    `user` VARCHAR,\n"
                                    + "    `type` VARCHAR\n"
                                    + " ) with (\n"
                                    + "    'connector' = 'filesystem',\n"
                                    + "    'path' = '%s',\n"
                                    + "    'format' = 'json'\n"
                                    + " )",
                            filesystemSourceFolder.getAbsolutePath()));

            gatewayRestClient.executeStatementWithResult(
                    " CREATE MATERIALIZED TABLE my_materialized_table_in_full_mode\n"
                            + "                        PARTITIONED BY (ds)\n"
                            + "                        WITH (\n"
                            + "                            'partition.fields.ds.date-formatter' = 'yyyy-MM-dd',\n"
                            + "                            'format' = 'json'\n"
                            + "                        )\n"
                            + "                        FRESHNESS = INTERVAL '30' SECOND\n"
                            + "                        REFRESH_MODE = FULL\n"
                            + "                        AS SELECT\n"
                            + "                            ds,\n"
                            + "                            count(*) as cnt\n"
                            + "                            FROM (\n"
                            + "                                SELECT\n"
                            + "                                    DATE_FORMAT(`timestamp`, 'yyyy-MM-dd') AS ds,\n"
                            + "                                    user,\n"
                            + "                                    type\n"
                            + "                                FROM batch_source\n"
                            + "                            ) GROUP BY ds");

            long systemTime = System.currentTimeMillis();
            String todayTimestamp =
                    formatTimestampMillis(systemTime, "yyyy-MM-dd HH:mm:ss", TimeZone.getDefault());
            String yesterdayTimestamp =
                    formatTimestampMillis(
                            systemTime - 24 * 60 * 60 * 1000,
                            "yyyy-MM-dd HH:mm:ss",
                            TimeZone.getDefault());
            String tomorrowTimestamp =
                    formatTimestampMillis(
                            systemTime + 24 * 60 * 60 * 1000,
                            "yyyy-MM-dd HH:mm:ss",
                            TimeZone.getDefault());
            String todayDateStr = todayTimestamp.substring(0, 10);
            String yesterdayDateStr = yesterdayTimestamp.substring(0, 10);
            String tomorrowDateStr = tomorrowTimestamp.substring(0, 10);

            
            gatewayRestClient.executeStatementWithResult(
                    String.format(
                            "INSERT INTO batch_source select TO_TIMESTAMP('%s'), 'Alice', 'INFO'",
                            todayTimestamp));
            gatewayRestClient.executeStatementWithResult(
                    String.format(
                            "INSERT INTO batch_source select TO_TIMESTAMP('%s'), 'Alice', 'INFO'",
                            yesterdayTimestamp));
            gatewayRestClient.executeStatementWithResult(
                    String.format(
                            "INSERT INTO batch_source select TO_TIMESTAMP('%s'), 'Alice', 'INFO'",
                            tomorrowTimestamp));

            
            gatewayRestClient.executeStatementWithResult("SET 'execution.runtime-mode' = 'batch'");

            
            
            CommonTestUtils.waitUtil(
                    () -> {
                        try {
                            List<RowData> result =
                                    gatewayRestClient.executeStatementWithResult(
                                            "select * from my_materialized_table_in_full_mode order by ds");
                            System.out.println(result);
                            return result.toString()
                                            .contains(String.format("+I(%s,1)", todayDateStr))
                                    || result.toString()
                                            .contains(String.format("+I(%s,1)", tomorrowDateStr));
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        }
                    },
                    fullModeWaitTime,
                    fullModeWaitPause,
                    "Failed to wait for the materialized table result");

            
            gatewayRestClient.executeStatementWithResult(
                    "ALTER MATERIALIZED TABLE my_materialized_table_in_full_mode SUSPEND");

            
            gatewayRestClient.executeStatementWithResult(
                    "ALTER MATERIALIZED TABLE my_materialized_table_in_full_mode RESUME");

            
            gatewayRestClient.executeStatementWithResult(
                    String.format(
                            "INSERT INTO batch_source select TO_TIMESTAMP('%s'), 'Bob', 'INFO'",
                            todayTimestamp));
            gatewayRestClient.executeStatementWithResult(
                    String.format(
                            "INSERT INTO batch_source select TO_TIMESTAMP('%s'), 'Bob', 'INFO'",
                            yesterdayTimestamp));
            gatewayRestClient.executeStatementWithResult(
                    String.format(
                            "INSERT INTO batch_source select TO_TIMESTAMP('%s'), 'Bob', 'INFO'",
                            tomorrowTimestamp));

            
            
            CommonTestUtils.waitUtil(
                    () -> {
                        try {
                            List<RowData> result =
                                    gatewayRestClient.executeStatementWithResult(
                                            "select * from my_materialized_table_in_full_mode order by ds");
                            System.out.println(result);
                            return result.toString()
                                            .contains(String.format("+I(%s,2)", todayDateStr))
                                    || result.toString()
                                            .contains(String.format("+I(%s,2)", tomorrowDateStr));
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        }
                    },
                    fullModeWaitTime,
                    fullModeWaitPause,
                    "Failed to wait for the result");

            
            gatewayRestClient.executeStatementWithResult(
                    "ALTER MATERIALIZED TABLE my_materialized_table_in_full_mode REFRESH PARTITION (ds='"
                            + todayDateStr
                            + "')");
            gatewayRestClient.executeStatementWithResult(
                    "ALTER MATERIALIZED TABLE my_materialized_table_in_full_mode REFRESH PARTITION (ds='"
                            + yesterdayDateStr
                            + "')");
            gatewayRestClient.executeStatementWithResult(
                    "ALTER MATERIALIZED TABLE my_materialized_table_in_full_mode REFRESH PARTITION (ds='"
                            + tomorrowDateStr
                            + "')");

            
            CommonTestUtils.waitUtil(
                    () -> {
                        try {
                            List<RowData> result =
                                    gatewayRestClient.executeStatementWithResult(
                                            "select * from my_materialized_table_in_full_mode order by ds");
                            System.out.println(result);
                            return result.toString()
                                    .equals(
                                            String.format(
                                                    "[+I(%s,2), +I(%s,2), +I(%s,2)]",
                                                    yesterdayDateStr,
                                                    todayDateStr,
                                                    tomorrowDateStr));
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        }
                    },
                    fullModeWaitTime,
                    fullModeWaitPause,
                    "Failed to wait for the result");
        }
    }

Line commented on: sessionProperties.put("table.catalog-store.kind", "file");

Revised code:
public void testMaterializedTableInFullMode() throws Exception {
        Duration fullModeWaitTime = Duration.ofMinutes(5);
        Duration fullModeWaitPause = Duration.ofSeconds(10);

        
        try (GatewayController gateway = flinkResource.startSqlGateway();
                ClusterController ignore = flinkResource.startCluster(2)) {

            Map<String, String> sessionProperties = new HashMap<>();
            sessionProperties.put("workflow-scheduler.type", "embedded");
            FlinkDistribution.TestSqlGatewayRestClient gatewayRestClient =
                    initSessionWithCatalogStore(sessionProperties);

            gatewayRestClient.executeStatementWithResult(
                    "CREATE TABLE batch_source (\n"
                            + "    `timestamp` TIMESTAMP(3),\n"
                            + "    `user` VARCHAR,\n"
                            + "    `type` VARCHAR\n"
                            + " ) with ("
                            + "   'format' = 'json'"
                            + ")");

            gatewayRestClient.executeStatementWithResult(
                    " CREATE MATERIALIZED TABLE my_materialized_table_in_full_mode\n"
                            + " PARTITIONED BY (ds)\n"
                            + " WITH (\n"
                            + "   'partition.fields.ds.date-formatter' = 'yyyy-MM-dd',\n"
                            + "   'format' = 'json'\n"
                            + " )\n"
                            + " FRESHNESS = INTERVAL '1' MINUTE\n"
                            + " REFRESH_MODE = FULL\n"
                            + " AS SELECT\n"
                            + " ds,\n"
                            + " count(*) as cnt\n"
                            + " FROM (\n"
                            + "   SELECT\n"
                            + "   DATE_FORMAT(`timestamp`, 'yyyy-MM-dd') AS ds,\n"
                            + "   user,\n"
                            + " type\n"
                            + " FROM batch_source\n"
                            + " ) GROUP BY ds");

            long systemTime = System.currentTimeMillis();
            String todayTimestamp =
                    formatTimestampMillis(systemTime, "yyyy-MM-dd HH:mm:ss", TimeZone.getDefault());
            String yesterdayTimestamp =
                    formatTimestampMillis(
                            systemTime - 24 * 60 * 60 * 1000,
                            "yyyy-MM-dd HH:mm:ss",
                            TimeZone.getDefault());
            String tomorrowTimestamp =
                    formatTimestampMillis(
                            systemTime + 24 * 60 * 60 * 1000,
                            "yyyy-MM-dd HH:mm:ss",
                            TimeZone.getDefault());
            String todayDateStr = todayTimestamp.substring(0, 10);
            String yesterdayDateStr = yesterdayTimestamp.substring(0, 10);
            String tomorrowDateStr = tomorrowTimestamp.substring(0, 10);

            
            gatewayRestClient.executeStatementWithResult(
                    String.format(
                            "INSERT INTO batch_source VALUES "
                                    + "(TO_TIMESTAMP('%s'), 'Alice', 'INFO'), "
                                    + "(TO_TIMESTAMP('%s'), 'Alice', 'INFO'), "
                                    + "(TO_TIMESTAMP('%s'), 'Alice', 'INFO')",
                            yesterdayTimestamp, todayTimestamp, tomorrowTimestamp));

            
            gatewayRestClient.executeStatementWithResult("SET 'execution.runtime-mode' = 'batch'");

            
            
            CommonTestUtils.waitUtil(
                    () -> {
                        List<RowData> result =
                                gatewayRestClient.executeStatementWithResult(
                                        "select * from my_materialized_table_in_full_mode order by ds");
                        String resultStr = result.toString();
                        return (resultStr.contains(String.format("+I(%s,1)", todayDateStr))
                                        || resultStr.contains(
                                                String.format("+I(%s,1)", tomorrowDateStr)))
                                && (!resultStr.contains(
                                        String.format("+I(%s,1)", yesterdayDateStr)));
                    },
                    fullModeWaitTime,
                    fullModeWaitPause,
                    "Failed to wait for the materialized table result");

            
            gatewayRestClient.executeStatementWithResult(
                    "ALTER MATERIALIZED TABLE my_materialized_table_in_full_mode SUSPEND");

            
            gatewayRestClient.executeStatementWithResult(
                    String.format(
                            "INSERT INTO batch_source VALUES "
                                    + "(TO_TIMESTAMP('%s'), 'Bob', 'INFO'), "
                                    + "(TO_TIMESTAMP('%s'), 'Bob', 'INFO'), "
                                    + "(TO_TIMESTAMP('%s'), 'Bob', 'INFO')",
                            yesterdayTimestamp, todayTimestamp, tomorrowTimestamp));

            
            gatewayRestClient.executeStatementWithResult(
                    "ALTER MATERIALIZED TABLE my_materialized_table_in_full_mode RESUME");

            
            
            CommonTestUtils.waitUtil(
                    () -> {
                        List<RowData> result =
                                gatewayRestClient.executeStatementWithResult(
                                        "select * from my_materialized_table_in_full_mode order by ds");
                        String resultStr = result.toString();
                        return (resultStr.contains(String.format("+I(%s,2)", todayDateStr))
                                        || resultStr.contains(
                                                String.format("+I(%s,2)", tomorrowDateStr)))
                                && (!resultStr.contains(
                                        String.format("+I(%s,2)", yesterdayDateStr)));
                    },
                    fullModeWaitTime,
                    fullModeWaitPause,
                    "Failed to wait for the result");

            
            gatewayRestClient.executeStatementWithResult(
                    "ALTER MATERIALIZED TABLE my_materialized_table_in_full_mode REFRESH PARTITION (ds='"
                            + todayDateStr
                            + "')");
            gatewayRestClient.executeStatementWithResult(
                    "ALTER MATERIALIZED TABLE my_materialized_table_in_full_mode REFRESH PARTITION (ds='"
                            + yesterdayDateStr
                            + "')");
            gatewayRestClient.executeStatementWithResult(
                    "ALTER MATERIALIZED TABLE my_materialized_table_in_full_mode REFRESH PARTITION (ds='"
                            + tomorrowDateStr
                            + "')");

            
            CommonTestUtils.waitUtil(
                    () -> {
                        List<RowData> result =
                                gatewayRestClient.executeStatementWithResult(
                                        "select * from my_materialized_table_in_full_mode order by ds");
                        return result.toString()
                                .equals(
                                        String.format(
                                                "[+I(%s,2), +I(%s,2), +I(%s,2)]",
                                                yesterdayDateStr, todayDateStr, tomorrowDateStr));
                    },
                    fullModeWaitTime,
                    fullModeWaitPause,
                    "Failed to wait for the result");

            
            gatewayRestClient.executeStatementWithResult(
                    "DROP MATERIALIZED TABLE my_materialized_table_in_full_mode");
        }
    }