🧪 test: add JWT secret rotation BDD scenarios and step implementations #12

Merged
arcodange merged 72 commits from feature/jwt-secret-rotation into main 2026-04-11 17:56:47 +02:00
7 changed files with 61 additions and 6 deletions
Showing only changes of commit 4292f79c6a - Show all commits

View File

@@ -47,6 +47,26 @@ Scenario: JWT authentication with multiple secrets
Then I should receive a valid JWT token
```
### Command-Line Tag Override
You can override the default tag filtering by setting the `GODOG_TAGS` environment variable when running tests.
**Usage:**
```bash
# Run only @wip scenarios
GODOG_TAGS="@wip" go test ./features/jwt/...
# Run smoke tests only
GODOG_TAGS="@smoke" go test ./features/...
# Run specific combination
GODOG_TAGS="@jwt && ~@todo" go test ./features/...
# Combine with other environment variables
DLC_DATABASE_HOST=localhost GODOG_TAGS="@wip" go test ./features/jwt/...
```
**Default Behavior:** If `GODOG_TAGS` is not set, the test uses the default tag filter: `~@flaky && ~@todo && ~@skip && @wip`
## Usage Examples
### Running Smoke Tests

View File

@@ -13,6 +13,13 @@ func TestAuthBDD(t *testing.T) {
// Set FEATURE environment variable for feature-specific configuration
os.Setenv("FEATURE", "auth")
// Allow tag override via environment variable
tags := os.Getenv("GODOG_TAGS")
if tags == "" {
// Default tags if not overridden
tags = "~@flaky && ~@todo && ~@skip && @wip"
}
suite := godog.TestSuite{
Name: "dance-lessons-coach BDD Tests - Auth Feature",
TestSuiteInitializer: bdd.InitializeTestSuite,
@@ -24,7 +31,7 @@ func TestAuthBDD(t *testing.T) {
Strict: true,
Randomize: -1,
StopOnFailure: true,
Tags: "~@flaky && ~@todo && ~@skip && @wip",
Tags: tags,
},
}

View File

@@ -13,6 +13,13 @@ func TestConfigBDD(t *testing.T) {
// Set FEATURE environment variable for feature-specific configuration
os.Setenv("FEATURE", "config")
// Allow tag override via environment variable
tags := os.Getenv("GODOG_TAGS")
if tags == "" {
// Default tags if not overridden
tags = "~@flaky && ~@todo && ~@skip && @wip"
}
suite := godog.TestSuite{
Name: "dance-lessons-coach BDD Tests - Config Feature",
TestSuiteInitializer: bdd.InitializeTestSuite,
@@ -24,7 +31,7 @@ func TestConfigBDD(t *testing.T) {
Strict: true,
Randomize: -1,
StopOnFailure: false,
Tags: "~@flaky && ~@todo && ~@skip && @wip",
Tags: tags,
},
}

View File

@@ -13,6 +13,13 @@ func TestGreetBDD(t *testing.T) {
// Set FEATURE environment variable for feature-specific configuration
os.Setenv("FEATURE", "greet")
// Allow tag override via environment variable
tags := os.Getenv("GODOG_TAGS")
if tags == "" {
// Default tags if not overridden
tags = "~@flaky && ~@todo && ~@skip && @wip"
}
suite := godog.TestSuite{
Name: "dance-lessons-coach BDD Tests - Greet Feature",
TestSuiteInitializer: bdd.InitializeTestSuite,
@@ -24,7 +31,7 @@ func TestGreetBDD(t *testing.T) {
Strict: true,
Randomize: -1,
StopOnFailure: true,
Tags: "~@flaky && ~@todo && ~@skip && @wip",
Tags: tags,
},
}

View File

@@ -13,6 +13,13 @@ func TestHealthBDD(t *testing.T) {
// Set FEATURE environment variable for feature-specific configuration
os.Setenv("FEATURE", "health")
// Allow tag override via environment variable
tags := os.Getenv("GODOG_TAGS")
if tags == "" {
// Default tags if not overridden
tags = "~@flaky && ~@todo && ~@skip && @wip"
}
suite := godog.TestSuite{
Name: "dance-lessons-coach BDD Tests - Health Feature",
TestSuiteInitializer: bdd.InitializeTestSuite,
@@ -24,7 +31,7 @@ func TestHealthBDD(t *testing.T) {
Strict: true,
Randomize: -1,
StopOnFailure: true,
Tags: "~@flaky && ~@todo && ~@skip && @wip",
Tags: tags,
},
}

View File

@@ -4,7 +4,7 @@ Feature: JWT Secret Rotation
I want to rotate JWT secrets without disrupting users
So that we can maintain security while ensuring continuous service
@todo
@wip
Scenario: Authentication with multiple valid JWT secrets
Given the server is running with multiple JWT secrets
And a user "multiuser" exists with password "testpass123"

View File

@@ -13,6 +13,13 @@ func TestJWTBDD(t *testing.T) {
// Set FEATURE environment variable for feature-specific configuration
os.Setenv("FEATURE", "jwt")
// Allow tag override via environment variable
tags := os.Getenv("GODOG_TAGS")
if tags == "" {
// Default tags if not overridden
tags = "~@flaky && ~@todo && ~@skip && @wip"
}
suite := godog.TestSuite{
Name: "dance-lessons-coach BDD Tests - JWT Feature",
TestSuiteInitializer: bdd.InitializeTestSuite,
@@ -24,7 +31,7 @@ func TestJWTBDD(t *testing.T) {
Strict: true,
Randomize: -1,
StopOnFailure: true,
Tags: "~@flaky && ~@todo && ~@skip && @wip",
Tags: tags,
},
}