Skip to content

Commit

Permalink
sync prometheus ext tests running in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
gabemontero committed Dec 11, 2017
1 parent d1ca9a7 commit 100628c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/extended/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"strconv"
"strings"
"sync"
"time"

g "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -292,19 +293,25 @@ func waitForServiceAccountInNamespace(c clientset.Interface, ns, serviceAccountN
return err
}

var (
processTemplate bool
mux sync.Mutex
)

func bringUpPrometheusFromTemplate(oc *exutil.CLI) (ns, host, bearerToken string, statsPort int) {
ns = oc.KubeFramework().Namespace.Name
host = "prometheus.kube-system.svc"
statsPort = 443
mustCreate := false
mux.Lock()
defer mux.Unlock()
if _, err := oc.AdminKubeClient().Apps().StatefulSets("kube-system").Get("prometheus", metav1.GetOptions{}); err != nil {
if !kapierrs.IsNotFound(err) {
o.Expect(err).NotTo(o.HaveOccurred())
}
mustCreate = true
processTemplate = true
}

if mustCreate {
if processTemplate {
e2e.Logf("Installing Prometheus onto the cluster for testing")
configPath := exutil.FixturePath("..", "..", "examples", "prometheus", "prometheus.yaml")
stdout, _, err := oc.WithoutNamespace().Run("process").Args("-f", configPath).Outputs()
Expand Down

0 comments on commit 100628c

Please sign in to comment.