Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/model/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func (p *Pod) FargateCapacityProvisioned() (float64, float64, bool) {
match := fargateCapacityRe.FindStringSubmatch(provisioned)
if len(match) != 3 {
log.Printf("unable to parse %q for fargate provisioner capacity", provisioned)
return 0, 0, false
}
cpu, err := strconv.ParseFloat(match[1], 64)
if err != nil {
Expand Down
11 changes: 11 additions & 0 deletions pkg/model/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,14 @@ func TestFargateCapacity(t *testing.T) {
t.Errorf("expected to have a mem capacity of 0.5, got %f", mem)
}
}

func TestFargateCapacityUnparsable(t *testing.T) {
tp := testPod("default", "mypod")
tp.Annotations = map[string]string{
"CapacityProvisioned": "unknown",
}
p := model.NewPod(tp)
if _, _, ok := p.FargateCapacityProvisioned(); ok {
t.Errorf("expected no fargate capacity for an unparsable annotation")
}
}