// Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: BUSL-1.1 package uiserver import ( "bytes" "io" "net/http" "net/http/httptest" "os" "path/filepath" "strings" "testing" "github.com/stretchr/testify/require" "golang.org/x/net/html" "github.com/hashicorp/go-hclog" "github.com/hashicorp/consul/agent/config" "github.com/hashicorp/consul/sdk/testutil" ) func TestUIServerIndex(t *testing.T) { cases := []struct { name string cfg *config.RuntimeConfig path string tx UIDataTransform wantStatus int wantContains []string wantNotContains []string wantEnv map[string]interface{} wantUICfgJSON string }{ { name: "basic UI serving", cfg: basicUIEnabledConfig(), path: "/", // Note /index.html redirects to / wantStatus: http.StatusOK, wantContains: []string{"