Permalink
Browse files

finished update to use parser lib

  • Loading branch information...
therealbill committed Apr 14, 2015
1 parent 6a546c4 commit 76c2bbb1339c2d354893424957228b6ae4616a62
Showing with 43 additions and 36 deletions.
  1. +1 −1 .version
  2. +3 −8 main.go
  3. +0 −27 sentinel-config_test.go
  4. +39 −0 sentinel_test.go
@@ -1 +1 @@
1.0.2
1.0.3
11 main.go
@@ -83,19 +83,14 @@ func main() {
if config.UseSentinelConfig {
log.Print("using sentinel config file")
/*
pod, err = getPodInfoFromConfig(podname)
if err != nil {
fmt.Printf("Pod %s not found\n", podname)
fmt.Printf("Error: %s\n", err.Error())
return
}
*/
sentinel, err := parser.ParseSentinelConfig(config.SentinelConfigFile)
if err != nil {
log.Fatal(err)
}
pod, err = sentinel.GetPod(podname)
if err != nil {
log.Fatal(err)
}
}
if config.UseRedSkull {
log.Print("Using RedSkull connection")

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,39 @@
package main
import (
"strings"
"testing"
"github.com/sentinel-tools/sconf-parser"
)
func TestValidPodFromSentinelConfig(t *testing.T) {
conf, err := parser.ParseSentinelConfig("sentinel.conf")
if err != nil {
t.Error(err)
t.Fail()
}
_, err = conf.GetPod("pod1")
if err != nil {
t.Error(err)
t.Fail()
}
}
func TestINValidPodFromSentinelConfig(t *testing.T) {
conf, err := parser.ParseSentinelConfig("sentinel.conf")
if err != nil {
t.Error(err)
t.Fail()
}
_, err = conf.GetPod("pod2")
if err == nil {
t.Error(err)
t.Fail()
} else {
if !strings.Contains(err.Error(), "not found") {
t.Error("Somehow found a pod which doesn't exist!")
t.Fail()
}
}
}

0 comments on commit 76c2bbb

Please sign in to comment.