Skip to content

Commit b5f3319

Browse files
Cover 15-Jun detection edge cases
- multi-group (eu+usa) fixture — pin that detection lands on the right group - a reacquired same-type box is priced at the new rate, not the torn-down box's gone April rate - DKH-653: skipped repro — all-hourly fleet leaves the group undetected
1 parent c85f86c commit b5f3319

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

tests/fixtures.bash

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,10 @@ grouping,product,description,reference,quantity,from,until,condition,unit,extern
115115
"P","CPX31 Cloud Server",t2,,"336",2026-06-16,2026-06-30,,"Hours","t2",,"€ 22.08"
116116
CSV
117117
}
118+
119+
jun2026_ephemeral_invoice() {
120+
cat > "$1" <<CSV
121+
grouping,product,description,reference,quantity,from,until,condition,unit,external id,price,total
122+
"P","CPX31 Cloud Server",eph,,"336",2026-06-16,2026-06-30,,"Hours","eph",,"€ 22.08"
123+
CSV
124+
}

tests/unit.bats

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,15 @@ CSV
176176
[ "$(sqlite3 "$db" "SELECT printf('%.2f', optimal) FROM priced WHERE box='t2';")" = "22.08" ]
177177
}
178178

179+
@test "an all-hourly fleet still detects its price group so a cheaper same-spec type is priced (no false 0% for short-lived boxes)" {
180+
skip "DKH-653: no monthly line -> detect_group empty -> cheaper same-spec type left unpriced; needs hourly-line voting"
181+
a="$BATS_TEST_TMPDIR/epa"; jun2026_assets "$a"
182+
d="$BATS_TEST_TMPDIR/epd"; mkdir -p "$d"; jun2026_ephemeral_invoice "$d/i.csv"
183+
db="$BATS_TEST_TMPDIR/ep.db"; build_db "$db" "$a" "$d" >/dev/null
184+
[ "$(sqlite3 "$db" "SELECT price_group FROM detected_group;")" = "eu" ]
185+
[ "$(sqlite3 "$db" "SELECT printf('%.2f', optimal) FROM priced;")" = "4.57" ]
186+
}
187+
179188
@test "gelkao -d <dir> <cn> runs the whole pipeline into <dir>: extract, fetch (skip), audit" {
180189
d="$BATS_TEST_TMPDIR/g"; mkdir -p "$d"
181190
uuid=11111111-2222-3333-4444-555555555555

0 commit comments

Comments
 (0)