From fb16dc1db329b80a3b3a97f6f92643bbd06af219 Mon Sep 17 00:00:00 2001 From: MichaelOultram Date: Wed, 12 Aug 2015 20:23:51 +0100 Subject: [PATCH] Fixing build errors --- circle.yml | 12 ++++++------ main.go | 15 ++++++++------- test.go | 3 ++- 3 files changed, 16 insertions(+), 14 deletions(-) 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{