Comments (12)
Could you please supply the error you are getting.
I don't think the inserted order of rows are guaranteed to be the order when you select them without an "order by" statement.
from otj-pg-embedded.
@gostaj - It is saying relation permissions
does not exist. Below is the full log
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=50384:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA CE.app/Contents/plugins/junit/lib/junit-rt.jar:/Applications/IntelliJ IDEA CE.app/Contents/plugins/junit/lib/junit5-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/lib/tools.jar:/Users/dmanna/workspaces/java/intellij/psql/target/test-classes:/Users/dmanna/.m2/repository/com/opentable/components/otj-pg-embedded/0.9.0/otj-pg-embedded-0.9.0.jar:/Users/dmanna/.m2/repository/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar:/Users/dmanna/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/Users/dmanna/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar:/Users/dmanna/.m2/repository/org/apache/commons/commons-compress/1.11/commons-compress-1.11.jar:/Users/dmanna/.m2/repository/org/tukaani/xz/1.5/xz-1.5.jar:/Users/dmanna/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar:/Users/dmanna/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar:/Users/dmanna/.m2/repository/org/postgresql/postgresql/9.4.1208/postgresql-9.4.1208.jar:/Users/dmanna/.m2/repository/junit/junit/4.12/junit-4.12.jar:/Users/dmanna/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/dmanna/.m2/repository/org/flywaydb/flyway-core/5.0.5/flyway-core-5.0.5.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.test.embedded.hello.EmbeddedPostgresTest
objc[39038]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java (0x102a3f4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x102b074e0). One of the two will be used. Which one is undefined.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
The files belonging to this database system will be owned by user "dmanna".
This user must also own the server process.
The database cluster will be initialized with locales
COLLATE: C
CTYPE: en_US.UTF-8
MESSAGES: C
MONETARY: C
NUMERIC: C
TIME: C
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/folders/6f/syk3yv496ln9mdw7cq3mkvfh00b62k/T/embedded-pg/b62d6afd-af35-4340-974c-44e51c53b067 ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
/var/folders/6f/syk3yv496ln9mdw7cq3mkvfh00b62k/T/embedded-pg/PG-bb0d2807196ef46c2b2e80868258adae/bin/pg_ctl -D /var/folders/6f/syk3yv496ln9mdw7cq3mkvfh00b62k/T/embedded-pg/b62d6afd-af35-4340-974c-44e51c53b067 -l logfile start
server starting
LOG: database system was shut down at 2018-01-08 20:02:23 IST
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
ERROR: relation "permissions" does not exist at character 15
STATEMENT: SELECT * FROM permissions
org.postgresql.util.PSQLException: ERROR: relation "permissions" does not exist
Position: 15
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2284)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2003)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:200)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:321)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:284)
at com.test.embedded.hello.EmbeddedPostgresTest.testTablesMade(EmbeddedPostgresTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
waiting for server to shut down....LOG: received fast shutdown request
LOG: aborting any active transactions
LOG: autovacuum launcher shutting down
FATAL: terminating connection due to administrator command
STATEMENT: CREATE DATABASE vnoytfrfrtvr OWNER postgres ENCODING = 'utf8'
LOG: shutting down
LOG: database system is shut down
done
server stopped
Process finished with exit code 255
from otj-pg-embedded.
It looks like your Flyway script isn't applied.
I have no clue if the code below is correct, please make sure that it is.
@Rule public PreparedDbRule db = EmbeddedPostgresRules.preparedDatabase(FlywayPreparer.forClasspathLocation("db"));
from otj-pg-embedded.
@gostaj - I have taken the line from FlywayPreparerTest.java in test
directory
I have posted the screenshot of my project layout. db
is under `src/test/resources so it will be in classpath.
from otj-pg-embedded.
Try to rename your SQL file from:
schema.sql
to:
V1__schema.sql
from otj-pg-embedded.
from otj-pg-embedded.
from otj-pg-embedded.
@debraj-manna Please see flywaydb.org. I don't think this needs to be document here - the tool is simply calling Flyway (as the name implies)
from otj-pg-embedded.
@debraj-manna DB must already exist for Flyway to run.
from otj-pg-embedded.
@mikebell90 - @Rule public PreparedDbRule db = EmbeddedPostgresRules.preparedDatabase(FlywayPreparer.forClasspathLocation("db"));
is creating the schemas before each test is run. So is there a way I can create the schemas only once when the class is loaded in @BeforeClass
.
from otj-pg-embedded.
@gostaj @mikebell90 - I am closing this. I have posted my queries in stackoverflow
from otj-pg-embedded.
This is not related to the otj-pg-embedded project.
Please see the Flyway test extensions project instead. It can help you with this.
from otj-pg-embedded.
Related Issues (20)
- IllegalStateException HOT 2
- No Postgres binary found for Darwin / aarch64 (Apple M1) HOT 2
- Lib not found HOT 3
- Snyk reports license warning for spotbugs-annotation dependency HOT 1
- Cannot resolve com.opentable.components:otj-spring:5.2.1 HOT 2
- Corrupted charsets in console HOT 1
- Catchpoint blog migration HOT 1
- Installed `postgres` binary is throwing segmentation fault on macOS 12.0 HOT 11
- Not working since upgrate to macOS 12 Monterey HOT 14
- PG Embedded - the Future (Update: 1.x now released) HOT 13
- M1 is not supported from the box HOT 2
- Cannot connect to database from other processes since 1.0.0 HOT 8
- The project README.md appears to have an incomplete statement HOT 3
- CurrVal function returns null in Postgres embedded db HOT 4
- Failed to build on Jenkins(docker refuses connection) HOT 3
- Unable to start postgresql on my machine HOT 2
- Can not connect to Ryuk at localhost:49163 HOT 1
- Docker environment failed issue HOT 3
- Darwin aarch64 support without Testcontainers HOT 1
- Java 8 compatibility HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from otj-pg-embedded.