Skip to content

Commit

Permalink
Test for password file
Browse files Browse the repository at this point in the history
  • Loading branch information
labianchin committed Aug 6, 2018
1 parent d8b28fc commit decaded
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,19 @@ class JdbcAvroJobTest extends FlatSpec with Matchers with BeforeAndAfterAll {
"jdbc:h2:mem:test2;MODE=PostgreSQL;DATABASE_TO_UPPER=false;DB_CLOSE_DELAY=-1"
private val db: Database = Database.forURL(connectionUrl, driver = "org.h2.Driver")
private val dir = tmpDir
private val passwordFile = new File(dir.getAbsolutePath + ".password")

def tmpDir: File = new File(
new File(sys.props("java.io.tmpdir")),
"jdbc-avro-test-" + UUID.randomUUID().toString)

override def beforeAll(): Unit = {
JdbcTestFixtures.createFixtures(db, Seq(JdbcTestFixtures.record1, JdbcTestFixtures.record2))
passwordFile.createNewFile()
}

override protected def afterAll(): Unit = {
passwordFile.delete()
Files.walk(dir.toPath)
.sorted(Comparator.reverseOrder())
.iterator()
Expand All @@ -59,7 +62,7 @@ class JdbcAvroJobTest extends FlatSpec with Matchers with BeforeAndAfterAll {
"--skipPartitionCheck",
"--connectionUrl=" + connectionUrl,
"--username=",
"--password=",
"--passwordFile=" + passwordFile.getAbsolutePath,
"--table=coffees",
"--output=" + dir.getAbsolutePath)
)
Expand Down

0 comments on commit decaded

Please sign in to comment.