diff --git a/circle.yml b/circle.yml index 937a4af..09d7ee0 100644 --- a/circle.yml +++ b/circle.yml @@ -12,12 +12,12 @@ dependencies: - make - make install cache_directories: - - "$HOME/opus" - - "$HOME/bin" - - "$HOME/gopath/bin" - - "$HOME/gopath/pkg" - - "$HOME/gopath/src/github.com/nitrous-io" - - "$HOME/gopath/src/github.com/MichaelOultram/mumbledj/.vendor" + - "opus" + - "bin" + - "gopath/bin" + - "gopath/pkg" + - "gopath/src/github.com/nitrous-io" + - "gopath/src/github.com/MichaelOultram/mumbledj/.vendor" test: override: - mumbledj -server=$MUMBLE_IP -port=$MUMBLE_PORT -username=circleci -password=$MUMBLE_PASSWORD -verbose=true -test=true: diff --git a/main.go b/main.go index f59a93c..9151d79 100644 --- a/main.go +++ b/main.go @@ -193,7 +193,7 @@ func main() { } var address, port, username, password, channel, pemCert, pemKey, accesstokens string - var insecure, verbose, test bool + var insecure, verbose, testcode bool flag.StringVar(&address, "server", "localhost", "address for Mumble server") flag.StringVar(&port, "port", "64738", "port for Mumble server") @@ -205,7 +205,7 @@ func main() { flag.StringVar(&accesstokens, "accesstokens", "", "list of access tokens for channel auth") flag.BoolVar(&insecure, "insecure", false, "skip certificate checking") flag.BoolVar(&verbose, "verbose", false, "[debug] prints out debug messages to the console") - flag.BoolVar(&test, "test", false, "[debug] tests the features of mumbledj") + flag.BoolVar(&testcode, "test", false, "[debug] tests the features of mumbledj") flag.Parse() dj.config = gumble.Config{ @@ -247,6 +247,12 @@ func main() { os.Exit(1) } + if testcode { + Verbose("Testing is enabled") + Test(password, address, port) + kill() + } + web = NewWebServer(9563) web.makeWeb() @@ -255,9 +261,4 @@ func main() { } <-dj.keepAlive - - if test { - Test(password, address, port) - kill() - } } diff --git a/test.go b/test.go index de8813e..4dcb63b 100644 --- a/test.go +++ b/test.go @@ -32,7 +32,8 @@ func (t TestSettings) createClient(uname string) *gumble.Client { func (t TestSettings) testYoutubeSong() { dummyClient := t.createClient("dummy") dummyClient.Connect() - dummyUser := dj.client.Users.Find("dummy") + time.Sleep(time.Second * 5) // Give dummy time to connect + dummyUser := dj.client.Users.Find("dummy") // May be nil // Don't judge, I used the (autogenerated) Top Tracks for United Kingdom playlist songs := map[string]string{