diff --git a/cmd/query/app/builder/builder_flags_test.go b/cmd/query/app/builder/builder_flags_test.go index cf8731c5f2c..b008df45dd0 100644 --- a/cmd/query/app/builder/builder_flags_test.go +++ b/cmd/query/app/builder/builder_flags_test.go @@ -24,9 +24,15 @@ import ( func TestQueryBuilderFlags(t *testing.T) { v, command := config.Viperize(AddFlags) - command.ParseFlags([]string{"--query.static-files=/dev/null", "--query.prefix=api", "--query.port=80"}) + command.ParseFlags([]string{ + "--query.static-files=/dev/null", + "--query.ui-config=some.json", + "--query.prefix=api", + "--query.port=80", + }) qOpts := new(QueryOptions).InitFromViper(v) - assert.Equal(t, "/dev/null", qOpts.QueryStaticAssets) - assert.Equal(t, "api", qOpts.QueryPrefix) - assert.Equal(t, 80, qOpts.QueryPort) + assert.Equal(t, "/dev/null", qOpts.StaticAssets) + assert.Equal(t, "some.json", qOpts.UIConfig) + assert.Equal(t, "api", qOpts.Prefix) + assert.Equal(t, 80, qOpts.Port) } diff --git a/cmd/query/app/static_handler.go b/cmd/query/app/static_handler.go index f5b942b60dd..9fdd8640d41 100644 --- a/cmd/query/app/static_handler.go +++ b/cmd/query/app/static_handler.go @@ -53,7 +53,7 @@ func NewStaticAssetsHandler(staticAssetsRoot string, uiConfig string) (*StaticAs } indexBytes, err := ioutil.ReadFile(staticAssetsRoot + "index.html") if err != nil { - return nil, errors.Wrap(err, "Cannot read index.html from UI static assets") + return nil, errors.Wrap(err, "Cannot read UI static assets") } configString := "JAEGER_CONFIG = DEFAULT_CONFIG;" if config, err := loadUIConfig(uiConfig); err != nil { diff --git a/cmd/query/app/static_handler_test.go b/cmd/query/app/static_handler_test.go index 2ffb0e1b8d6..d9aa4f3d813 100644 --- a/cmd/query/app/static_handler_test.go +++ b/cmd/query/app/static_handler_test.go @@ -29,7 +29,8 @@ import ( func TestStaticAssetsHandler(t *testing.T) { r := mux.NewRouter() - handler := NewStaticAssetsHandler("fixture") + handler, err := NewStaticAssetsHandler("fixture", "") + require.NoError(t, err) handler.RegisterRoutes(r) server := httptest.NewServer(r) defer server.Close() @@ -45,13 +46,14 @@ func TestStaticAssetsHandler(t *testing.T) { } func TestDefaultStaticAssetsRoot(t *testing.T) { - handler := NewStaticAssetsHandler("") - assert.Equal(t, "jaeger-ui-build/build/", handler.staticAssetsRoot) + _, err := NewStaticAssetsHandler("", "") + assert.EqualError(t, err, "Cannot read UI static assets: open jaeger-ui-build/build/index.html: no such file or directory") } func TestRegisterRoutesHandler(t *testing.T) { r := mux.NewRouter() - handler := NewStaticAssetsHandler("fixture/") + handler, err := NewStaticAssetsHandler("fixture/", "") + require.NoError(t, err) handler.RegisterRoutes(r) server := httptest.NewServer(r) defer server.Close()