Skip to content

Commit

Permalink
test(scorecard): increase nginx proxy size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
tthvo committed Jul 4, 2024
1 parent ca1e7a0 commit 83cf119
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions internal/test/scorecard/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func NewCryostatRESTClientset(base *url.URL) *CryostatRESTClientset {
},
GrafanaClient: &GrafanaClient{
commonCryostatRESTClient: commonClient,
Prefix: "grafana",
BasePath: "grafana",
},
}
}
Expand Down Expand Up @@ -598,12 +598,12 @@ func (client *CredentialClient) Create(ctx context.Context, credential *Credenti

// Client for Grafana API
type GrafanaClient struct {
Prefix string
BasePath string
*commonCryostatRESTClient
}

func (client *GrafanaClient) GetDatasourceByName(ctx context.Context, name string) (*DataSource, error) {
url := client.Base.JoinPath(client.Prefix, "api/datasources/name", GRAFANA_DATASOURCE_NAME)
url := client.Base.JoinPath(client.BasePath, "api/datasources/name", GRAFANA_DATASOURCE_NAME)
header := make(http.Header)
header.Add("Accept", "*/*")

Expand Down
1 change: 1 addition & 0 deletions internal/test/scorecard/common_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ func configureIngress(name string, cryostatSpec *operatorv1beta2.CryostatSpec) {
CoreConfig: &operatorv1beta2.NetworkConfiguration{
Annotations: map[string]string{
"nginx.ingress.kubernetes.io/backend-protocol": "HTTPS",
"nginx.ingress.kubernetes.io/proxy-body-size": "10m",
},
IngressSpec: &netv1.IngressSpec{
TLS: []netv1.IngressTLS{{}},
Expand Down
4 changes: 2 additions & 2 deletions internal/test/scorecard/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
operatorv1beta2 "github.com/cryostatio/cryostat-operator/api/v1beta2"
scapiv1alpha3 "github.com/operator-framework/api/pkg/apis/scorecard/v1alpha3"
apimanifests "github.com/operator-framework/api/pkg/manifests"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
Expand Down Expand Up @@ -341,7 +341,7 @@ func CryostatGrafanaTest(bundle *apimanifests.Bundle, namespace string, openShif
apiClient := NewCryostatRESTClientset(base)

// Get JFR data
cm, err := r.Client.CoreV1().ConfigMaps(namespace).Get(context.Background(), jfrConfigMapName, v1.GetOptions{})
cm, err := r.Client.CoreV1().ConfigMaps(namespace).Get(context.Background(), jfrConfigMapName, metav1.GetOptions{})
if err != nil {
return r.fail(fmt.Sprintf("failed to get ConfigMap containing JFR data: %s", err.Error()))
}
Expand Down
13 changes: 6 additions & 7 deletions internal/test/scorecard/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,14 @@ type ArchiveGraphQLResponse struct {
}

const (
GRAFANA_DASHBOARD_UID = "main"
GRAFANA_DASHBOARD_TITLE = "Cryostat Dashboard"
GRAFANA_DATASOURCE_NAME = "jfr-datasource"
GRAFANA_DATASOURCE_URL = "http://127.0.0.1:8989"
GRAFANA_DATASOURCE_TYPE = "grafana-simple-json-datasource"
GRAFANA_DATASOURCE_ACCESS = "proxy"
)

// Grafana types
// DataSource represents a Grafana data source
type DataSource struct {
ID int64 `json:"id"`
UID string `json:"uid"`
Expand All @@ -172,8 +173,6 @@ type DataSource struct {
URL string `json:"url"`
Access string `json:"access"`

ReadOnly bool `json:"readOnly"`
IsDefault bool `json:"isDefault"`
BasicAuth bool `json:"basicAuth"`
}

Expand All @@ -186,12 +185,12 @@ func (ds *DataSource) Valid() error {
return fmt.Errorf("expected datasource type %s, but got %s", GRAFANA_DATASOURCE_TYPE, ds.Type)
}

if ds.URL != GRAFANA_DATASOURCE_URL {
return fmt.Errorf("expected datasource url %s, but got %s", GRAFANA_DATASOURCE_URL, ds.URL)
if len(ds.URL) == 0 {
return errors.New("expected datasource url, but got empty")
}

if ds.Access != GRAFANA_DATASOURCE_ACCESS {
return fmt.Errorf("expected datasource access %s, but got %s", GRAFANA_DATASOURCE_ACCESS, ds.Access)
return fmt.Errorf("expected datasource access mode %s, but got %s", GRAFANA_DATASOURCE_ACCESS, ds.Access)
}

if ds.BasicAuth {
Expand Down

0 comments on commit 83cf119

Please sign in to comment.