Skip to content

Commit 5e2d7d7

Browse files
authored
chore: fix benchmark (#1698)
This was out of date. I've updated it to use the correct format, and update the asserts accordingly. Signed-off-by: Todd Baert <[email protected]>
1 parent e8fd680 commit 5e2d7d7

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@ site
2020
.cache/
2121

2222
# coverage results
23-
*coverage.out
23+
*coverage.out
24+
25+
# benchmark results
26+
benchmark.txt

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ test-flagd-proxy:
4949
go test -race -covermode=atomic -cover -short ./flagd-proxy/pkg/... -coverprofile=flagd-proxy-coverage.out
5050
flagd-integration-test: # dependent on ./bin/flagd start -f file:test-harness/flags/testing-flags.json -f file:test-harness/flags/custom-ops.json -f file:test-harness/flags/evaluator-refs.json -f file:test-harness/flags/zero-flags.json
5151
go test -cover ./test/integration $(ARGS)
52+
flagd-benchmark-test:
53+
go test -bench=Bench -short -benchtime=5s -benchmem ./core/... | tee benchmark.txt
5254
run: # default to flagd
5355
make run-flagd
5456
run-flagd:

core/pkg/evaluator/fractional_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ func BenchmarkFractionalEvaluation(b *testing.B) {
508508
},
509509
{
510510
"fractional": [
511-
"email",
511+
{"var": "email"},
512512
[
513513
"red",
514514
25
@@ -542,41 +542,41 @@ func BenchmarkFractionalEvaluation(b *testing.B) {
542542
expectedReason string
543543
expectedErrorCode string
544544
}{
545-
"test@faas.com": {
545+
"test_a@faas.com": {
546546
flags: flags,
547547
flagKey: "headerColor",
548548
context: map[string]any{
549-
"email": "test@faas.com",
549+
"email": "test_a@faas.com",
550550
},
551-
expectedVariant: "red",
552-
expectedValue: "#FF0000",
551+
expectedVariant: "blue",
552+
expectedValue: "#0000FF",
553553
expectedReason: model.TargetingMatchReason,
554554
},
555-
"test2@faas.com": {
555+
"test_b@faas.com": {
556556
flags: flags,
557557
flagKey: "headerColor",
558558
context: map[string]any{
559-
"email": "test2@faas.com",
559+
"email": "test_b@faas.com",
560560
},
561-
expectedVariant: "yellow",
562-
expectedValue: "#FFFF00",
561+
expectedVariant: "red",
562+
expectedValue: "#FF0000",
563563
expectedReason: model.TargetingMatchReason,
564564
},
565-
"test3@faas.com": {
565+
"test_c@faas.com": {
566566
flags: flags,
567567
flagKey: "headerColor",
568568
context: map[string]any{
569-
"email": "test3@faas.com",
569+
"email": "test_c@faas.com",
570570
},
571-
expectedVariant: "red",
572-
expectedValue: "#FF0000",
571+
expectedVariant: "green",
572+
expectedValue: "#00FF00",
573573
expectedReason: model.TargetingMatchReason,
574574
},
575-
"test4@faas.com": {
575+
"test_d@faas.com": {
576576
flags: flags,
577577
flagKey: "headerColor",
578578
context: map[string]any{
579-
"email": "test4@faas.com",
579+
"email": "test_d@faas.com",
580580
},
581581
expectedVariant: "blue",
582582
expectedValue: "#0000FF",

0 commit comments

Comments
 (0)