Skip to content

Commit

Permalink
Add dep and travisCI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Ullaakut committed Jan 21, 2019
1 parent 9a86a80 commit 07b515f
Show file tree
Hide file tree
Showing 12 changed files with 637 additions and 22 deletions.
23 changes: 3 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,20 @@ services:
- docker

before_install:
- sudo apt-get install -y nmap
- go get github.com/mattn/goveralls
- go get github.com/pkg/errors
- go get gopkg.in/go-playground/validator.v9
- go get github.com/stretchr/testify/assert
- docker version
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep

install:
- dep ensure
- docker build -t cameradar .

script:
# Run unit tests
- go test -v -covermode=count -coverprofile=coverage.out
- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken=$COVERALLS_TOKEN
# Launch a fake camera to check if cameradar is able to access it
- docker run -d --name=fake_camera -e RTSP_USERNAME=admin -e RTSP_PASSWORD=12345 -p 8554:8554 ullaakut/rtspatt
# Launch cameradar on the local machine
- docker run --net=host -t cameradar -t 0.0.0.0 -l > logs.txt
- docker logs fake_camera > camera_logs.txt
# Stop the fake camera
- docker stop fake_camera
# Print logs
- cat camera_logs.txt
- cat logs.txt
# check if file contains more than one line
# 1 line: Error message because no streams were found
# More lines: Logs for all found cameras
- if [[ $(wc -l <logs.txt) -lt 2 ]]; then exit 1; fi

# Ensure the examples compile
- for dir in examples/*/; do go build -o $dir/bin $dir/main.go; done
notifications:
email:
recipients:
Expand Down
17 changes: 17 additions & 0 deletions Gopkg.lock

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

34 changes: 34 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/pkg/errors"
version = "0.8.1"

[prune]
go-tests = true
unused-packages = true
Binary file added main
Binary file not shown.
10 changes: 8 additions & 2 deletions nmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ package nmap

import (
"context"
"os/exec"
"reflect"
"strings"
"testing"
"time"
)

func TestRun(t *testing.T) {
nmapPath, err := exec.LookPath("nmap")
if err != nil {
panic("nmap is required to run those tests")
}

tests := []struct {
description string
options []func(*Scanner)
Expand Down Expand Up @@ -52,7 +58,7 @@ func TestRun(t *testing.T) {
},

expectedResult: &Run{
Args: "/usr/local/bin/nmap -oX - localhost",
Args: nmapPath + " -oX - localhost",
Scanner: "nmap",
},
},
Expand All @@ -69,7 +75,7 @@ func TestRun(t *testing.T) {
},

expectedResult: &Run{
Args: "/usr/local/bin/nmap -oX - localhost",
Args: nmapPath + " -oX - localhost",
Scanner: "nmap",
},
},
Expand Down
24 changes: 24 additions & 0 deletions vendor/github.com/pkg/errors/.gitignore

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

15 changes: 15 additions & 0 deletions vendor/github.com/pkg/errors/.travis.yml

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

23 changes: 23 additions & 0 deletions vendor/github.com/pkg/errors/LICENSE

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

52 changes: 52 additions & 0 deletions vendor/github.com/pkg/errors/README.md

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

32 changes: 32 additions & 0 deletions vendor/github.com/pkg/errors/appveyor.yml

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

Loading

0 comments on commit 07b515f

Please sign in to comment.