-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from muuki88/wip/debian-upstart-tests
Adding tests for default upstart configuration
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import NativePackagerKeys._ | ||
import com.typesafe.sbt.packager.archetypes.ServerLoader | ||
|
||
packageArchetype.java_server | ||
|
||
serverLoading in Debian := ServerLoader.Upstart | ||
|
||
daemonUser in Debian := "root" | ||
|
||
mainClass in Compile := Some("empty") | ||
|
||
name := "debian-test" | ||
|
||
version := "0.1.0" | ||
|
||
maintainer := "Josh Suereth <joshua.suereth@typesafe.com>" | ||
|
||
packageSummary := "Test debian package" | ||
|
||
packageDescription := """A fun package description of our software, | ||
with multiple lines.""" | ||
|
||
TaskKey[Unit]("check-control-files") <<= (target, streams) map { (target, out) => | ||
val debian = target / "debian-test-0.1.0" / "DEBIAN" | ||
val postinst = IO.read(debian / "postinst") | ||
val prerm = IO.read(debian / "prerm") | ||
assert(postinst contains "initctl reload-configuration", "postinst misses initctl: " + postinst) | ||
assert(postinst contains """service debian-test start || echo "debian-test could not be started. Try manually with service debian-test start"""", "postinst misses service start: " + postinst) | ||
assert(prerm contains """service debian-test stop || echo "debian-test wasn't even running!"""", "prerm misses stop: " + prerm) | ||
out.log.success("Successfully tested upstart control files") | ||
() | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Run the debian packaging. | ||
> debian:package-bin | ||
$ exists target/debian-test-0.1.0.deb | ||
|
||
$ exists target/debian-test-0.1.0/etc | ||
$ exists target/debian-test-0.1.0/etc/init/debian-test.conf | ||
# Check defaults | ||
$ exists target/debian-test-0.1.0/DEBIAN/prerm | ||
$ exists target/debian-test-0.1.0/DEBIAN/postinst | ||
|
||
# Check files for defaults | ||
> check-control-files |