在Spring Boot中运行测试时,Liquibase不会从测试/资源目录中获取变更集

问题描述

我具有以下配置:

├── src
│   ├── main
...
│   │   └── resources
│   │       ├── db
│   │       │   └── changelog
│   │       │       ├── changes
│   │       │       │   ├── db.changelog-1.0.insert-data.xml
│   │       │       │   └── db.changelog-1.0.xml
│   │       │       ├── db.changelog-master.xml
│   │       ├── env-profiles
│   │       │   └── application.yml
...
│   └── test
...
│       └── resources
│           ├── db
│           │   └── changelog
│           │       ├── changes
│           │       │   ├── db.changelog-1.0.insert-data.xml
│           │       │   └── db.changelog-1.0.xml
│           │       ├── db.changelog-master.xml
│           └── env-profiles
│               └── application.yml

application.ymlmain目录中的test都包含相同的Liquibase设置:

spring:
...
  liquibase:
    enabled: true
    change-log: classpath:db.changelog-master.xml

这是db.changelog-master.xml

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
            http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
    <include file="db.changelog-1.0.xml" />
    <include file="db.changelog-1.0.insert-data.xml" />
</databaseChangeLog>

maintest目录中的变更日志文件之间的区别在于测试的种子数据。

当我使用@SpringBootTest运行集成测试时,可以看到来自test的application.yml已被拾取,但是Liquibase从main目录而不是从test执行更改集test

在当前设置中运行测试时,如何配置Spring Boot或Liquibase以使其从$emit目录中选择更改集?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...