gpt4 book ai didi

grails - Grails 2.3.8应用程序集成测试失败

转载 作者:行者123 更新时间:2023-12-02 15:05:56 25 4
gpt4 key购买 nike

我有一个开始编写的简单grails应用程序。到目前为止,我只有几个域类,没有其他伪像。昨天,我运行了唯一的一项集成测试,该测试通过了。今天,当我运行它时,我得到以下输出:

2015-04-23 11:07:37,000 [main] ERROR hbm2ddl.SchemaUpdate  - Unsuccessful: create table or
der (id bigint generated by default as identity, version bigint not null, customer_id bigi
nt not null, date_created timestamp not null, total float not null, primary key (id))
Error |
2015-04-23 11:07:37,002 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"CREATE TABLE ORDER[*] (ID BIGINT GENERATED BY DEFAULT AS IDENTITY, VERSION BIGINT NOT NU
LL, CUSTOMER_ID BIGINT NOT NULL, DATE_CREATED TIMESTAMP NOT NULL, TOTAL FLOAT NOT NULL, PR
IMARY KEY (ID)) "; expected "identifier"; SQL statement:
create table order (id bigint generated by default as identity, version bigint not null, c
ustomer_id bigint not null, date_created timestamp not null, total float not null, primary
key (id)) [42001-173]
Error |
2015-04-23 11:07:37,004 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: alter table ord
er add constraint FK651874E6A961CB1 foreign key (customer_id) references customer
Error |
2015-04-23 11:07:37,004 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"ALTER TABLE ORDER[*] ADD CONSTRAINT FK651874E6A961CB1 FOREIGN KEY (CUSTOMER_ID) REFERENC
ES CUSTOMER "; expected "identifier"; SQL statement:
alter table order add constraint FK651874E6A961CB1 foreign key (customer_id) references cu
stomer [42001-173]
Error |
2015-04-23 11:07:37,005 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: alter table ord
er_item add constraint FK2D110D6455275AA3 foreign key (order_id) references order
Error |
2015-04-23 11:07:37,005 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"ALTER TABLE ORDER_ITEM ADD CONSTRAINT FK2D110D6455275AA3 FOREIGN KEY (ORDER_ID) REFERENC
ES ORDER[*] "; expected "identifier"; SQL statement:
alter table order_item add constraint FK2D110D6455275AA3 foreign key (order_id) references
order [42001-173]
.......
|Compiling 1 source files
..
|Tests PASSED - view reports in C:\Users

当我打开HTML测试结果页面时,它说没有执行任何测试。我什至尝试了 grails clean-all。此时,我的项目才刚刚开始,因此我可以轻松创建一个新应用并将代码复制到该应用上,但是我很想知道该应用有什么问题。昨天这个测试运行良好并通过,我所做的只是关闭我的IDE,然后今天再次启动它。我什至关闭了ide,并试图从命令提示符下运行测试,但结果仍然相同。

如果有人想看代码,它是 here

最佳答案

在测试环境下(准确地说是here)将dbCreate = "update"修改为dbCreate = "create-drop"中的DataSource.groovy应该可以解决此问题。

基本上,它将在两次测试之间重新创建db,这在测试期间是一种更干净的方法。

关于grails - Grails 2.3.8应用程序集成测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29827668/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com