github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/cmd/query-tee/main_test.go (about)

     1  package main
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestCortexReadRoutes(t *testing.T) {
    11  	routes := cortexReadRoutes(Config{PathPrefix: ""})
    12  	for _, r := range routes {
    13  		assert.True(t, strings.HasPrefix(r.Path, "/api/v1/"))
    14  	}
    15  
    16  	routes = cortexReadRoutes(Config{PathPrefix: "/some/random/prefix///"})
    17  	for _, r := range routes {
    18  		assert.True(t, strings.HasPrefix(r.Path, "/some/random/prefix/api/v1/"))
    19  	}
    20  }