Skip to content

Illegal State issue from initdb #65

Closed
@jweaver-pfi

Description

Hi, I'm attempting to use otj-pg-embedded-0.11.0 (as downloaded from the maven repository) on a windows 10 system and I am getting the following when I attempt a simple junit test:

java.lang.IllegalStateException: Process [C:\Users\john\AppData\Local\Temp\embedded-pg\PG-20610842f7206a9abbecdcf12709c0f8\bin\initdb.exe, -A, trust, -U, postgres, -D, C:\Users\john\AppData\Local\Temp\epg3467157523703904606, -E, UTF-8] failed

at com.opentable.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:558)
at com.opentable.db.postgres.embedded.EmbeddedPostgres.initdb(EmbeddedPostgres.java:223)
at com.opentable.db.postgres.embedded.EmbeddedPostgres.<init>(EmbeddedPostgres.java:141)
at com.opentable.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:545)
at com.opentable.db.postgres.embedded.EmbeddedPostgres.start(EmbeddedPostgres.java:445)
at com.opentable.db.postgres.junit.SingleInstancePostgresRule.before(SingleInstancePostgresRule.java:35)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:41)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

The unit test is copied from from your test:

package com.billerica.manager.database;

import com.opentable.db.postgres.junit.EmbeddedPostgresRules;
import com.opentable.db.postgres.junit.SingleInstancePostgresRule;
import org.junit.Rule;
import org.junit.Test;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import static org.junit.Assert.*;

public class testSingleInstanceEmbeddedPg {

@Rule
public SingleInstancePostgresRule epg = EmbeddedPostgresRules.singleInstance();

@Test
public void testSingleInstance() throws Exception {
    try (Connection c = epg.getEmbeddedPostgres().getPostgresDatabase().getConnection()) {
        assertNotNull(epg);
        Statement s = c.createStatement();
        ResultSet rs = s.executeQuery("SELECT 1");
        assertTrue(rs.next());
        assertEquals(1, rs.getInt(1));
        assertFalse(rs.next());
    }
}

}

I see that the temp folder epg3467157523703904606 is empty, if that says anything. I haven't found any log files in the temporary folders.

Other tests give similar results. Sorry if I have missed something obvious; I haven't done any other configuration or setup.

Thanks for any help you can provide.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions