Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
nblumhardt committed Jan 24, 2019
2 parents 1d7ddb3 + 17969a4 commit 000ad48
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 147 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.idea

/publish
*.orig
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 123 additions & 2 deletions ci/build-deps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ function Invoke-LinuxBuild

if ($IsCIBuild) {
$hostShare = "X:\host"
pushd "$hostShare/src"
Push-Location "$hostShare/src"
}

& "./ci/cross-build.ps1" 2>&1
if ($LASTEXITCODE) { exit 1 }

if ($IsCIBuild) {
popd
Pop-Location
Copy-Item -Path "$hostShare/src/target" -Recurse -Destination . -Container
}
}
Expand Down Expand Up @@ -113,4 +113,125 @@ function Publish-Container($version)

& docker push datalust/sqelf-ci:$version
if ($LASTEXITCODE) { exit 1 }
}

function Start-SeqEnvironment {
Write-BeginStep $MYINVOCATION

Push-Location ci/smoke-test

$ErrorActionPreference = "SilentlyContinue"

& docker rm -f sqelf-test-seq | Out-Null
& docker rm -f sqelf-test-sqelf | Out-Null

& docker network rm sqelf-test | Out-Null

& docker network create sqelf-test
if ($LASTEXITCODE) {
Pop-Location
exit 1
}

& docker pull datalust/seq:latest
& docker run --name sqelf-test-seq `
--network sqelf-test `
-e ACCEPT_EULA=Y `
-itd `
-p 5342:80 `
datalust/seq:latest
if ($LASTEXITCODE) {
Pop-Location
exit 1
}

& docker run --name sqelf-test-sqelf `
--network sqelf-test `
-e SEQ_ADDRESS=http://sqelf-test-seq:5341 `
-itd `
-p 12202:12201/udp `
sqelf-ci:latest
if ($LASTEXITCODE) {
Pop-Location
exit 1
}

# Give Seq enough time to start up
Start-Sleep -Seconds 5

$ErrorActionPreference = "Stop"

Pop-Location
}

function Stop-SeqEnvironment {
Write-BeginStep $MYINVOCATION

Push-Location ci/smoke-test

& docker rm -f sqelf-test-seq
if ($LASTEXITCODE) {
Pop-Location
exit 1
}

& docker rm -f sqelf-test-sqelf
if ($LASTEXITCODE) {
Pop-Location
exit 1
}

& docker network rm sqelf-test
if ($LASTEXITCODE) {
Pop-Location
exit 1
}

Pop-Location
}

function Build-TestAppContainer {
Write-BeginStep $MYINVOCATION

& docker build --file ci/smoke-test/app/Dockerfile -t sqelf-app-test:latest .
if ($LASTEXITCODE) { exit 1 }
}

function Invoke-TestApp {
Write-BeginStep $MYINVOCATION

& docker run `
--rm `
-it `
--log-driver gelf `
--log-opt gelf-address=udp://localhost:12202 `
sqelf-app-test:latest
if ($LASTEXITCODE) { exit 1 }

# Give sqelf enough time to batch and send
Start-Sleep -Seconds 2
}

function Check-ClefOutput {
Write-BeginStep $MYINVOCATION

$json = Invoke-RestMethod -Uri http://localhost:5342/api/events?clef

if (-Not $json) {
throw [System.Exception] "CLEF output is empty"
} else {
$json
}
}

function Check-SqelfLogs {
Write-BeginStep $MYINVOCATION

& docker logs sqelf-test-sqelf
}

function Check-SeqLogs {
Write-BeginStep $MYINVOCATION

& docker logs sqelf-test-seq
}
18 changes: 16 additions & 2 deletions ci/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,22 @@ Initialize-Docker
Initialize-Filesystem
Invoke-LinuxBuild
Invoke-DockerBuild
Invoke-WindowsBuild
Invoke-NuGetPack $shortver

if ($IsWindows) {
Invoke-WindowsBuild
Invoke-NuGetPack $shortver
}
else {
Write-Output "Not running Windows build"
}

Build-TestAppContainer
Start-SeqEnvironment
Invoke-TestApp
Check-SqelfLogs
Check-SeqLogs
Check-ClefOutput
Stop-SeqEnvironment

if ($IsPublishedBuild) {
Publish-Container $shortver
Expand Down
6 changes: 0 additions & 6 deletions ci/smoke-test/README.md

This file was deleted.

95 changes: 0 additions & 95 deletions ci/smoke-test/check.ps1

This file was deleted.

20 changes: 0 additions & 20 deletions ci/smoke-test/docker-compose.yml

This file was deleted.

3 changes: 3 additions & 0 deletions sqelf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ version = "0.1"
[dependencies.tokio]
version = "0.1"

[dependencies.tokio-signal]
version = "0.2"

[dependencies.bytes]
version = "0.4"

Expand Down
Loading

0 comments on commit 000ad48

Please sign in to comment.