Kaynağa Gözat

use simpler migration test

Ajay Tripathy 4 yıl önce
ebeveyn
işleme
ae301ad1aa
1 değiştirilmiş dosya ile 3 ekleme ve 2 silme
  1. 3 2
      pkg/costmodel/allocation.go

+ 3 - 2
pkg/costmodel/allocation.go

@@ -2,12 +2,13 @@ package costmodel
 
 
 import (
 import (
 	"fmt"
 	"fmt"
-	"github.com/kubecost/cost-model/pkg/util/timeutil"
 	"math"
 	"math"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
 	"time"
 	"time"
 
 
+	"github.com/kubecost/cost-model/pkg/util/timeutil"
+
 	"github.com/kubecost/cost-model/pkg/cloud"
 	"github.com/kubecost/cost-model/pkg/cloud"
 	"github.com/kubecost/cost-model/pkg/env"
 	"github.com/kubecost/cost-model/pkg/env"
 	"github.com/kubecost/cost-model/pkg/kubecost"
 	"github.com/kubecost/cost-model/pkg/kubecost"
@@ -895,7 +896,7 @@ func applyRAMBytesUsedMax(podMap map[podKey]*Pod, resRAMBytesUsedMax []*prom.Que
 }
 }
 
 
 func applyGPUsRequested(podMap map[podKey]*Pod, resGPUsRequested []*prom.QueryResult, resGPUsAllocated []*prom.QueryResult) {
 func applyGPUsRequested(podMap map[podKey]*Pod, resGPUsRequested []*prom.QueryResult, resGPUsAllocated []*prom.QueryResult) {
-	if len(resGPUsAllocated) >= len(resGPUsRequested) { // Use the new query, when it's been available in a window longer/equal to than the old query
+	if len(resGPUsAllocated) > 0 { // Use the new query, when it's become available in a window
 		resGPUsRequested = resGPUsAllocated
 		resGPUsRequested = resGPUsAllocated
 	}
 	}
 	for _, res := range resGPUsRequested {
 	for _, res := range resGPUsRequested {