Given up on go test, using my own

This commit is contained in:
MichaelOultram 2015-08-10 01:19:27 +01:00
parent 2a42e4456c
commit 2bb84599ea
3 changed files with 20 additions and 12 deletions

View file

@ -15,4 +15,4 @@ before_install:
- bash install-dependencies.sh
after_success:
- go test
- mumbledj -server=$MUMBLE_IP -port=$MUMBLE_PORT -username=travis -password=$MUMBLE_PASSWORD -test=true

10
main.go
View file

@ -193,7 +193,7 @@ func main() {
}
var address, port, username, password, channel, pemCert, pemKey, accesstokens string
var insecure, verbose bool
var insecure, verbose, test bool
flag.StringVar(&address, "server", "localhost", "address for Mumble server")
flag.StringVar(&port, "port", "64738", "port for Mumble server")
@ -204,7 +204,8 @@ func main() {
flag.StringVar(&pemKey, "key", "", "path to user PEM key for MumbleDJ")
flag.StringVar(&accesstokens, "accesstokens", "", "list of access tokens for channel auth")
flag.BoolVar(&insecure, "insecure", false, "skip certificate checking")
flag.BoolVar(&verbose, "verbose", false, "prints out debug messages to the console")
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.Parse()
dj.config = gumble.Config{
@ -254,4 +255,9 @@ func main() {
}
<-dj.keepAlive
if test {
Test(password, address, port)
kill()
}
}

View file

@ -2,19 +2,21 @@ package main
import (
"github.com/layeh/gumble/gumble"
"os"
"testing"
)
func createClient(uname string) *gumble.Client {
return gumble.NewClient(&gumble.Config{
Username: uname,
Password: os.Getenv("MUMBLE_PASSWORD"),
Address: os.Getenv("MUMBLE_IP") + ":" + os.Getenv("MUMBLE_PORT")})
func Test(password, ip, port string) {
}
func TestYoutubeSong(t *testing.T) {
dummyClient := createClient("dummy")
func createClient(uname, password, ip, port string) *gumble.Client {
return gumble.NewClient(&gumble.Config{
Username: uname,
Password: password,
Address: ip + ":" + port})
}
func testYoutubeSong(password, ip, port string) {
dummyClient := createClient("dummy", password, ip, port)
dummyClient.Connect()
dummyUser := dj.client.Users.Find("dummy")