chore(sql): sync container workspace permissions
This commit is contained in:
+21
@@ -4,6 +4,8 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -89,6 +91,25 @@ class ContainerWorkspacePermissionSqlContractTest {
|
||||
"INSERT IGNORE INTO iam_role_permission");
|
||||
}
|
||||
|
||||
@Test
|
||||
void unifiedIncrementContainsTheCompleteModuleSql() throws Exception {
|
||||
Path unifiedPath = Path.of("deploy", "sql", "头程数据库统一增量-MySQL8.sql");
|
||||
if (!Files.exists(unifiedPath)) {
|
||||
unifiedPath = Path.of("..", "deploy", "sql", "头程数据库统一增量-MySQL8.sql");
|
||||
}
|
||||
String unified = Files.readString(unifiedPath, StandardCharsets.UTF_8);
|
||||
String startMarker = "-- 货柜双工作台权限开始(与 iam/db/container-workspace-permissions.sql 保持一致)";
|
||||
String endMarker = "-- 货柜双工作台权限结束,恢复头程数据库上下文";
|
||||
int start = unified.indexOf(startMarker);
|
||||
int bodyStart = unified.indexOf('\n', start) + 1;
|
||||
int end = unified.indexOf(endMarker, bodyStart);
|
||||
|
||||
assertThat(start).isGreaterThanOrEqualTo(0);
|
||||
assertThat(bodyStart).isGreaterThan(start);
|
||||
assertThat(end).isGreaterThan(bodyStart);
|
||||
assertThat(unified.substring(bodyStart, end).trim()).isEqualTo(sql().trim());
|
||||
}
|
||||
|
||||
private static String sql() throws Exception {
|
||||
return new ClassPathResource("db/container-workspace-permissions.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
|
||||
Reference in New Issue
Block a user