Browse Source

Update builds to include modules tests, fold tests from tests dir into packages.

Matt Bolt 1 year ago
parent
commit
655b875dd2

+ 22 - 0
core/pkg/util/promutil/promutil_test.go

@@ -4,6 +4,8 @@ import (
 	"fmt"
 	"reflect"
 	"testing"
+
+	"github.com/opencost/opencost/core/pkg/util/json"
 )
 
 func checkSlice(s1, s2 []string) error {
@@ -205,3 +207,23 @@ func TestSanitizeLabels(t *testing.T) {
 		})
 	}
 }
+
+func TestClusterInfoLabels(t *testing.T) {
+	expected := map[string]bool{"clusterprofile": true, "errorreporting": true, "id": true, "logcollection": true, "name": true, "productanalytics": true, "provider": true, "provisioner": true, "remotereadenabled": true, "thanosenabled": true, "valuesreporting": true, "version": true}
+	clusterInfo := `{"clusterProfile":"production","errorReporting":"true","id":"cluster-one","logCollection":"true","name":"bolt-3","productAnalytics":"true","provider":"GCP","provisioner":"GKE","remoteReadEnabled":"false","thanosEnabled":"false","valuesReporting":"true","version":"1.14+"}`
+
+	var m map[string]any
+	err := json.Unmarshal([]byte(clusterInfo), &m)
+	if err != nil {
+		t.Errorf("Error: %s", err)
+		return
+	}
+
+	labels := MapToLabels(m)
+	for k := range expected {
+		if _, ok := labels[k]; !ok {
+			t.Errorf("Failed to locate key: \"%s\" in labels.", k)
+			return
+		}
+	}
+}

+ 11 - 1
justfile

@@ -11,8 +11,18 @@ test-core:
     {{commonenv}} cd ./core && go test ./... -coverprofile=coverage.out
     {{commonenv}} cd ./core && go vet ./...
 
+# run prometheus-source unit tests 
+test-prometheus-source:
+    {{commonenv}} cd ./modules/prometheus-source && go test ./... -coverprofile=coverage.out
+    {{commonenv}} cd ./modules/prometheus-source && go vet ./...
+
+# run collector-source unit tests
+test-collector-source:
+    {{commonenv}} cd ./modules/collector-source && go test ./... -coverprofile=coverage.out
+    {{commonenv}} cd ./modules/collector-source && go vet ./...
+
 # Run unit tests
-test: test-core
+test: test-core test-prometheus-source test-collector-source
     {{commonenv}} go test ./... -coverprofile=coverage.out
     {{commonenv}} go vet ./...
 

+ 79 - 31
test/cloud_test.go → pkg/cloud/provider/cloud_test.go

@@ -1,4 +1,4 @@
-package test
+package provider_test
 
 import (
 	"fmt"
@@ -108,9 +108,9 @@ func TestPVPriceFromCSV(t *testing.T) {
 
 	wantPrice := "0.1337"
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_pv.csv",
+		CSVLocation: "../../../configs/pricing_schema_pv.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 	c.DownloadPricingData()
@@ -142,9 +142,9 @@ func TestPVPriceFromCSVStorageClass(t *testing.T) {
 
 	wantPrice := "0.1338"
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_pv_storageclass.csv",
+		CSVLocation: "../../../configs/pricing_schema_pv_storageclass.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 	c.DownloadPricingData()
@@ -192,9 +192,9 @@ func TestNodePriceFromCSVWithGPU(t *testing.T) {
 	wantPrice2 := "1.733700"
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema.csv",
+		CSVLocation: "../../../configs/pricing_schema.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 
@@ -238,9 +238,33 @@ func TestNodePriceFromCSVWithGPU(t *testing.T) {
 }
 
 func TestNodePriceFromCSVWithGPULabels(t *testing.T) {
+	const defaultConfigJson = `{"provider":"base","description":"Default prices based on GCP us-central1","CPU":"0.021811","spotCPU":"0.006543","RAM":"0.002923","spotRAM":"0.000877","GPU":"0.95","spotGPU":"0.308","storage":"0.00005479452","zoneNetworkEgress":"0.01","regionNetworkEgress":"0.01","internetNetworkEgress":"0.12","firstFiveForwardingRulesCost":"","additionalForwardingRuleCost":"","LBIngressDataCost":"","athenaBucketName":"","athenaRegion":"","athenaDatabase":"","athenaCatalog":"","athenaTable":"","athenaWorkgroup":"","masterPayerARN":"","customPricesEnabled":"false","defaultIdle":"","azureSubscriptionID":"","azureClientID":"","azureClientSecret":"","azureTenantID":"","azureBillingRegion":"","azureBillingAccount":"","azureOfferDurableID":"","azureStorageSubscriptionID":"","azureStorageAccount":"","azureStorageAccessKey":"","azureStorageContainer":"","azureContainerPath":"","azureCloud":"","currencyCode":"","discount":"","negotiatedDiscount":"","sharedOverhead":"","clusterName":"","sharedNamespaces":"","sharedLabelNames":"","sharedLabelValues":"","shareTenancyCosts":"true","readOnly":"","editorAccess":"","kubecostToken":"","googleAnalyticsTag":"","excludeProviderID":"","defaultLBPrice":""}`
+
 	nameWant := "gke-standard-cluster-1-pool-1-91dc432d-cg69"
 	wantGPUCost := "0.75"
 
+	tempPath := t.TempDir()
+	currentPath, err := filepath.Abs(".")
+	if err != nil {
+		t.Skip(fmt.Sprintf("Unable to get absolute path for current dir: '%s' - Error: %s - Skipping test.", currentPath, err))
+		return
+	}
+
+	configPath, err := filepath.Rel(currentPath, tempPath)
+	if err != nil {
+		t.Skip(fmt.Sprintf("Unable to get relative path for temp dir: '%s' - Error: %s - Skipping test.", tempPath, err))
+		return
+	}
+
+	err = os.WriteFile(filepath.Join(configPath, "default.json"), []byte(defaultConfigJson), 0644)
+	if err != nil {
+		t.Skip(fmt.Sprintf("Unable to write temporary json config file: '%s' - Error: %s - Skipping test.", filepath.Join(configPath, "default.json"), err))
+		return
+	}
+
+	t.Logf("Setting Config Path to: %s", configPath)
+	t.Setenv("CONFIG_PATH", configPath)
+
 	confMan := config.NewConfigFileManager(&config.ConfigFileManagerOpts{
 		LocalConfigPath: "./",
 	})
@@ -254,9 +278,9 @@ func TestNodePriceFromCSVWithGPULabels(t *testing.T) {
 	n.Status.Capacity = v1.ResourceList{"nvidia.com/gpu": *resource.NewScaledQuantity(2, 0)}
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_gpu_labels.csv",
+		CSVLocation: "../../../configs/pricing_schema_gpu_labels.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "default.json"),
 		},
 	}
 
@@ -283,9 +307,33 @@ func TestNodePriceFromCSVWithGPULabels(t *testing.T) {
 }
 
 func TestRKE2NodePriceFromCSVWithGPULabels(t *testing.T) {
+	const defaultConfigJson = `{"provider":"base","description":"Default prices based on GCP us-central1","CPU":"0.021811","spotCPU":"0.006543","RAM":"0.002923","spotRAM":"0.000877","GPU":"0.95","spotGPU":"0.308","storage":"0.00005479452","zoneNetworkEgress":"0.01","regionNetworkEgress":"0.01","internetNetworkEgress":"0.12","firstFiveForwardingRulesCost":"","additionalForwardingRuleCost":"","LBIngressDataCost":"","athenaBucketName":"","athenaRegion":"","athenaDatabase":"","athenaCatalog":"","athenaTable":"","athenaWorkgroup":"","masterPayerARN":"","customPricesEnabled":"false","defaultIdle":"","azureSubscriptionID":"","azureClientID":"","azureClientSecret":"","azureTenantID":"","azureBillingRegion":"","azureBillingAccount":"","azureOfferDurableID":"","azureStorageSubscriptionID":"","azureStorageAccount":"","azureStorageAccessKey":"","azureStorageContainer":"","azureContainerPath":"","azureCloud":"","currencyCode":"","discount":"","negotiatedDiscount":"","sharedOverhead":"","clusterName":"","sharedNamespaces":"","sharedLabelNames":"","sharedLabelValues":"","shareTenancyCosts":"true","readOnly":"","editorAccess":"","kubecostToken":"","googleAnalyticsTag":"","excludeProviderID":"","defaultLBPrice":""}`
+
 	nameWant := "gke-standard-cluster-1-pool-1-91dc432d-cg69"
 	wantGPUCost := "0.750000"
 
+	tempPath := t.TempDir()
+	currentPath, err := filepath.Abs(".")
+	if err != nil {
+		t.Skip(fmt.Sprintf("Unable to get absolute path for current dir: '%s' - Error: %s - Skipping test.", currentPath, err))
+		return
+	}
+
+	configPath, err := filepath.Rel(currentPath, tempPath)
+	if err != nil {
+		t.Skip(fmt.Sprintf("Unable to get relative path for temp dir: '%s' - Error: %s - Skipping test.", tempPath, err))
+		return
+	}
+
+	err = os.WriteFile(filepath.Join(configPath, "default.json"), []byte(defaultConfigJson), 0644)
+	if err != nil {
+		t.Skip(fmt.Sprintf("Unable to write temporary json config file: '%s' - Error: %s - Skipping test.", filepath.Join(configPath, "default.json"), err))
+		return
+	}
+
+	t.Logf("Setting Config Path to: %s", configPath)
+	t.Setenv("CONFIG_PATH", configPath)
+
 	confMan := config.NewConfigFileManager(&config.ConfigFileManagerOpts{
 		LocalConfigPath: "./",
 	})
@@ -300,9 +348,9 @@ func TestRKE2NodePriceFromCSVWithGPULabels(t *testing.T) {
 	n.Status.Capacity = v1.ResourceList{"nvidia.com/gpu": *resource.NewScaledQuantity(2, 0)}
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_gpu_labels.csv",
+		CSVLocation: "../../../configs/pricing_schema_gpu_labels.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "default.json"),
 		},
 	}
 
@@ -343,9 +391,9 @@ func TestNodePriceFromCSVSpecialChar(t *testing.T) {
 	wantPrice := "0.133700"
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_special_char.csv",
+		CSVLocation: "../../../configs/pricing_schema_special_char.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 	c.DownloadPricingData()
@@ -381,9 +429,9 @@ func TestNodePriceFromCSV(t *testing.T) {
 	wantPrice := "0.133700"
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema.csv",
+		CSVLocation: "../../../configs/pricing_schema.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 	c.DownloadPricingData()
@@ -413,9 +461,9 @@ func TestNodePriceFromCSV(t *testing.T) {
 	}
 
 	c2 := &provider.CSVProvider{
-		CSVLocation: "../configs/fake.csv",
+		CSVLocation: "../../../configs/fake.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 	k3 := c.GetKey(n.Labels, n)
@@ -459,9 +507,9 @@ func TestNodePriceFromCSVWithRegion(t *testing.T) {
 	wantPrice3 := "0.1339"
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_region.csv",
+		CSVLocation: "../../../configs/pricing_schema_region.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 	c.DownloadPricingData()
@@ -515,9 +563,9 @@ func TestNodePriceFromCSVWithRegion(t *testing.T) {
 	}
 
 	c2 := &provider.CSVProvider{
-		CSVLocation: "../configs/fake.csv",
+		CSVLocation: "../../../configs/fake.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 	k5 := c.GetKey(n.Labels, n)
@@ -630,7 +678,7 @@ func TestNodePriceFromCSVWithBadConfig(t *testing.T) {
 	})
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_case.csv",
+		CSVLocation: "../../../configs/pricing_schema_case.csv",
 		CustomProvider: &provider.CustomProvider{
 			Config: provider.NewProviderConfig(confMan, "invalid.json"),
 		},
@@ -657,16 +705,16 @@ func TestNodePriceFromCSVWithBadConfig(t *testing.T) {
 }
 
 func TestSourceMatchesFromCSV(t *testing.T) {
-	os.Setenv("CONFIG_PATH", "../configs")
+	os.Setenv("CONFIG_PATH", "../../../configs")
 
 	confMan := config.NewConfigFileManager(&config.ConfigFileManagerOpts{
 		LocalConfigPath: "./",
 	})
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_case.csv",
+		CSVLocation: "../../../configs/pricing_schema_case.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "/default.json"),
+			Config: provider.NewProviderConfig(confMan, "default.json"),
 		},
 	}
 	c.DownloadPricingData()
@@ -743,9 +791,9 @@ func TestNodePriceFromCSVWithCase(t *testing.T) {
 	})
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_case.csv",
+		CSVLocation: "../../../configs/pricing_schema_case.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 
@@ -789,9 +837,9 @@ func TestNodePriceFromCSVMixed(t *testing.T) {
 	wantPrice2 := "1.654795"
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_mixed_gpu_ondemand.csv",
+		CSVLocation: "../../../configs/pricing_schema_mixed_gpu_ondemand.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 	c.DownloadPricingData()
@@ -836,9 +884,9 @@ func TestNodePriceFromCSVByClass(t *testing.T) {
 	})
 
 	c := &provider.CSVProvider{
-		CSVLocation: "../configs/pricing_schema_case.csv",
+		CSVLocation: "../../../configs/pricing_schema_case.csv",
 		CustomProvider: &provider.CustomProvider{
-			Config: provider.NewProviderConfig(confMan, "../configs/default.json"),
+			Config: provider.NewProviderConfig(confMan, "../../../configs/default.json"),
 		},
 	}
 

+ 1 - 1
test/keytuple_test.go → pkg/costmodel/keytuple_test.go

@@ -1,4 +1,4 @@
-package test
+package costmodel_test
 
 import (
 	"strings"

+ 0 - 28
test/clusterinfo_test.go

@@ -1,28 +0,0 @@
-package test
-
-import (
-	"testing"
-
-	"github.com/opencost/opencost/core/pkg/util/json"
-	"github.com/opencost/opencost/core/pkg/util/promutil"
-)
-
-func TestClusterInfoLabels(t *testing.T) {
-	expected := map[string]bool{"clusterprofile": true, "errorreporting": true, "id": true, "logcollection": true, "name": true, "productanalytics": true, "provider": true, "provisioner": true, "remotereadenabled": true, "thanosenabled": true, "valuesreporting": true, "version": true}
-	clusterInfo := `{"clusterProfile":"production","errorReporting":"true","id":"cluster-one","logCollection":"true","name":"bolt-3","productAnalytics":"true","provider":"GCP","provisioner":"GKE","remoteReadEnabled":"false","thanosEnabled":"false","valuesReporting":"true","version":"1.14+"}`
-
-	var m map[string]interface{}
-	err := json.Unmarshal([]byte(clusterInfo), &m)
-	if err != nil {
-		t.Errorf("Error: %s", err)
-		return
-	}
-
-	labels := promutil.MapToLabels(m)
-	for k := range expected {
-		if _, ok := labels[k]; !ok {
-			t.Errorf("Failed to locate key: \"%s\" in labels.", k)
-			return
-		}
-	}
-}

+ 0 - 1
test/configs/default.json

@@ -1 +0,0 @@
-{"provider":"base","description":"Default prices based on GCP us-central1","CPU":"0.021811","spotCPU":"0.006543","RAM":"0.002923","spotRAM":"0.000877","GPU":"0.95","spotGPU":"0.308","storage":"0.00005479452","zoneNetworkEgress":"0.01","regionNetworkEgress":"0.01","internetNetworkEgress":"0.12","firstFiveForwardingRulesCost":"","additionalForwardingRuleCost":"","LBIngressDataCost":"","athenaBucketName":"","athenaRegion":"","athenaDatabase":"","athenaCatalog":"","athenaTable":"","athenaWorkgroup":"","masterPayerARN":"","customPricesEnabled":"false","defaultIdle":"","azureSubscriptionID":"","azureClientID":"","azureClientSecret":"","azureTenantID":"","azureBillingRegion":"","azureBillingAccount":"","azureOfferDurableID":"","azureStorageSubscriptionID":"","azureStorageAccount":"","azureStorageAccessKey":"","azureStorageContainer":"","azureContainerPath":"","azureCloud":"","currencyCode":"","discount":"","negotiatedDiscount":"","sharedOverhead":"","clusterName":"","sharedNamespaces":"","sharedLabelNames":"","sharedLabelValues":"","shareTenancyCosts":"true","readOnly":"","editorAccess":"","kubecostToken":"","googleAnalyticsTag":"","excludeProviderID":"","defaultLBPrice":""}

+ 0 - 12
test/kubernetes/cluster-role-binding.yaml

@@ -1,12 +0,0 @@
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
-  name: cost-model
-roleRef:
-  apiGroup: rbac.authorization.k8s.io
-  kind: ClusterRole
-  name: cost-model
-subjects:
-  - kind: ServiceAccount
-    name: cost-model
-    namespace: default

+ 0 - 80
test/kubernetes/cluster-role.yaml

@@ -1,80 +0,0 @@
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
-  name: cost-model 
-rules:
-  - apiGroups:
-      - ''
-    resources:
-      - configmaps
-      - deployments
-      - nodes
-      - pods
-      - services
-      - resourcequotas
-      - replicationcontrollers
-      - limitranges
-      - persistentvolumeclaims
-      - persistentvolumes
-      - namespaces
-      - endpoints
-    verbs:
-      - get
-      - list
-      - watch
-      - create
-  - apiGroups:
-      - extensions
-    resources:
-      - daemonsets
-      - deployments
-      - replicasets
-    verbs:
-      - get
-      - list
-      - watch
-  - apiGroups:
-      - apps
-    resources:
-      - statefulsets
-      - deployments
-      - daemonsets
-      - replicasets
-    verbs:
-      - list
-      - watch
-      - create
-      - delete
-  - apiGroups:
-      - batch
-    resources:
-      - cronjobs
-      - jobs
-    verbs:
-      - get
-      - list
-      - watch
-  - apiGroups:
-      - autoscaling
-    resources:
-      - horizontalpodautoscalers
-    verbs:
-      - get
-      - list
-      - watch
-  - apiGroups:
-      - policy
-    resources:
-      - poddisruptionbudgets
-    verbs:
-      - get
-      - list
-      - watch
-  - apiGroups: 
-      - storage.k8s.io
-    resources: 
-      - storageclasses
-    verbs:
-      - get
-      - list
-      - watch

+ 0 - 4
test/kubernetes/service-account.yaml

@@ -1,4 +0,0 @@
-apiVersion: v1
-kind: ServiceAccount
-metadata:
-  name: cost-model

+ 0 - 30
test/kubernetes/test-pod.yaml

@@ -1,30 +0,0 @@
-apiVersion: batch/v1
-kind: Job
-metadata:
-  name: cost-model-test
-  labels:
-    app: cost-model-test
-spec:
-  backoffLimit: 0
-  template:
-    metadata:
-      labels:
-        app: cost-model-test
-    spec:
-      restartPolicy: Never
-      serviceAccountName: cost-model
-      containers:
-        - image: ajaytripathy/kubecost-cost-model-integration:latest
-          name: cost-model
-          securityContext:
-            runAsUser: 0
-          resources:
-            requests:
-              cpu: "10m"
-              memory: "55M"
-          env:
-            - name: PROMETHEUS_SERVER_ENDPOINT
-              value: http://kubecost-prometheus-server.kubecost #The endpoint should have the form http://<service-name>.<namespace-name>.svc.cluster.local 
-            - name: CLOUD_PROVIDER_API_KEY
-              value: "AIzaSyDXQPG_MHUEy9neR7stolq6l0ujXmjJlvk" # The GCP Pricing API requires a key.
-          imagePullPolicy: Always

+ 0 - 65
test/remote_cluster_test.go

@@ -1,65 +0,0 @@
-package test
-
-import (
-	_ "k8s.io/client-go/plugin/pkg/client/auth"
-)
-
-/*
-func TestClusterConvergence(t *testing.T) {
-	rclient, err := getKubernetesClient()
-	if err != nil {
-		panic(err)
-	}
-	var LongTimeoutRoundTripper http.RoundTripper = &http.Transport{ // may be necessary for long prometheus queries. TODO: make this configurable
-		Proxy: http.ProxyFromEnvironment,
-		DialContext: (&net.Dialer{
-			Timeout:   120 * time.Second,
-			KeepAlive: 120 * time.Second,
-		}).DialContext,
-		TLSHandshakeTimeout: 10 * time.Second,
-	}
-
-	pc := prometheusClient.Config{
-		Address:      os.Getenv(PROMETHEUS_SERVER_ENDPOINT),
-		RoundTripper: LongTimeoutRoundTripper,
-	}
-	promCli, err := prometheusClient.NewClient(pc)
-	if err != nil {
-		panic(err)
-	}
-	cm := costModel.NewCostModel(rclient)
-
-	provider := &cloud.CustomProvider{
-		Clientset: rclient,
-	}
-	loc, _ := time.LoadLocation("UTC")
-	endTime := time.Now().In(loc)
-	d, _ := time.ParseDuration("24h")
-	startTime := endTime.Add(-1 * d)
-	layout := "2006-01-02T15:04:05.000Z"
-	startStr := startTime.Format(layout)
-	endStr := endTime.Format(layout)
-	log.Printf("Starting at %s \n", startStr)
-	log.Printf("Ending at %s \n", endStr)
-	provider.DownloadPricingData()
-
-	data, err := cm.ComputeCostDataRange(promCli, rclient, provider, startStr, endStr, "1h", "", "", false)
-	if err != nil {
-		panic(err)
-	}
-
-	os.Setenv("SQL_ADDRESS", "ab5cfc235d64e11e9b8280265f54018f-778641917.us-east-2.elb.amazonaws.com")
-	os.Setenv("REMOTE_WRITE_PASSWORD", "savemoney123")
-
-	data2, err := cm.ComputeCostDataRange(promCli, rclient, provider, startStr, endStr, "1h", "", "", true)
-	if err != nil {
-		panic(err)
-	}
-
-	agg := costModel.AggregateCostData(data, "namespace", []string{""}, provider, nil)
-	agg2 := costModel.AggregateCostData(data2, "namespace", []string{""}, provider, nil)
-
-	assert.Equal(t, agg["kubecost"].TotalCost, agg2["kubecost"].TotalCost)
-
-}
-*/