diff options
author | Jakob Odersky <jakob@odersky.com> | 2017-03-06 01:32:39 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2017-03-06 01:32:39 -0800 |
commit | 374ac0ce8c10e9063c263ecf9c708f9ee6772973 (patch) | |
tree | a80f53db0a5ee8e3c40e1941b331869a2560164d /crashbox-server/src/test/scala/io/crashbox/ci/SourceSpec.scala | |
parent | f9cc5e3f8478eb9f19cca093b8019e579f9c87e6 (diff) | |
download | crashbox-ci-374ac0ce8c10e9063c263ecf9c708f9ee6772973.tar.gz crashbox-ci-374ac0ce8c10e9063c263ecf9c708f9ee6772973.tar.bz2 crashbox-ci-374ac0ce8c10e9063c263ecf9c708f9ee6772973.zip |
Basic, single-task builder
Diffstat (limited to 'crashbox-server/src/test/scala/io/crashbox/ci/SourceSpec.scala')
-rw-r--r-- | crashbox-server/src/test/scala/io/crashbox/ci/SourceSpec.scala | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crashbox-server/src/test/scala/io/crashbox/ci/SourceSpec.scala b/crashbox-server/src/test/scala/io/crashbox/ci/SourceSpec.scala new file mode 100644 index 0000000..9bef01d --- /dev/null +++ b/crashbox-server/src/test/scala/io/crashbox/ci/SourceSpec.scala @@ -0,0 +1,35 @@ +package io.crashbox.ci + +import java.io.File +import java.nio.file.Files +import java.net.URL +import org.eclipse.jgit.api.Git +import scala.concurrent.duration._ +import scala.concurrent.Await +import org.scalatest._ + +class SourceSpec extends FlatSpec with Matchers with Source with Core { + + val Timeout = 10.seconds + + def makeRepo(dir: File): Unit = { + Git.init().setDirectory(dir).call() + val file1 = new File(dir, "file1") + file1.createNewFile() + val file2 = new File(dir, "file2") + file2.createNewFile() + Git.open(dir).add().addFilepattern(".").call() + Git.open(dir).commit().setMessage("initial commit").call() + } + + "GitFetchers" should "be able to clone a local repository" in { + TestUtil.withTempDir{ remote => + makeRepo(remote) + TestUtil.withTempDir { local => + val cloned = Await.result(fetchSource(remote.toURI().toURL(), local), Timeout) + assert(cloned.listFiles().length == 3) + } + } + } + +} |