-
Notifications
You must be signed in to change notification settings - Fork 19
Feat: Added Project Groups API & Add Test Run Status Tracking #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
saini-prakhyat
wants to merge
10
commits into
guidewire-oss:main
Choose a base branch
from
saini-prakhyat:feat/test-run-filter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8ceee4b
gsupdates test runs get api
saini-prakhyat 6434569
removed commented code
saini-prakhyat e26ee02
feat: fixed query
saini-prakhyat 7b8486d
feat: updated project group endpoint
saini-prakhyat 17d8b53
feat: removed unnecessary changes
saini-prakhyat 0cf1cb0
feat: restored preferred apis and created project group api
saini-prakhyat 8985e06
Merge branch 'main' of https://github.com/saini-prakhyat/fern-reporte…
saini-prakhyat 57eda5f
feat: added test case and reverted uneccessary changes
saini-prakhyat 9880126
feat: fixed routes
saini-prakhyat dd4e183
feat: updated query to filter based on test_seed
saini-prakhyat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| package datamigrations | ||
|
|
||
| import ( | ||
| "github.com/guidewire/fern-reporter/pkg/models" | ||
| "gorm.io/gorm" | ||
| "log" | ||
| "strings" | ||
| ) | ||
|
|
||
| func BackfillTestRunStatus(db *gorm.DB) { | ||
|
|
||
| // Short-circuit if all test runs already have status | ||
| var missingStatusCount int64 | ||
| db.Model(&models.TestRun{}).Where("status IS NULL OR status = ''").Count(&missingStatusCount) | ||
| if missingStatusCount == 0 { | ||
| log.Println("No test runs missing status. Skipping backfill.") | ||
| return | ||
| } | ||
|
|
||
| const batchSize = 100 | ||
| offset := 0 | ||
|
|
||
| log.Println("Initiating test run status update .") | ||
saini-prakhyat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| for { | ||
| var testRuns []models.TestRun | ||
|
|
||
| err := db.Preload("SuiteRuns.SpecRuns"). | ||
| Where("status IS NULL OR status = ''"). | ||
| Limit(batchSize). | ||
| Offset(offset). | ||
saini-prakhyat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
saini-prakhyat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
saini-prakhyat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Find(&testRuns).Error | ||
|
|
||
| if err != nil { | ||
| log.Printf("Backfill failed at offset %d: %v\n", offset, err) | ||
saini-prakhyat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return | ||
| } | ||
|
|
||
| if len(testRuns) == 0 { | ||
| break | ||
| } | ||
|
|
||
| for _, testRun := range testRuns { | ||
| status := "PASSED" | ||
|
|
||
| for _, suite := range testRun.SuiteRuns { | ||
| for _, spec := range suite.SpecRuns { | ||
| if strings.EqualFold(spec.Status, "FAILED") { | ||
| status = "FAILED" | ||
| goto UpdateStatus | ||
| } | ||
| if strings.EqualFold(spec.Status, "SKIPPED") && status != "FAILED" { | ||
| status = "SKIPPED" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| UpdateStatus: | ||
| if err := db.Model(&models.TestRun{}). | ||
| Where("id = ?", testRun.ID). | ||
| Update("status", status).Error; err != nil { | ||
| log.Printf("Failed to update test_run ID %d: %v\n", testRun.ID, err) | ||
| } | ||
| } | ||
|
|
||
| offset += batchSize | ||
| } | ||
|
|
||
| log.Println("Test run status update is complete.") | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ALTER TABLE public.test_runs | ||
|
|
||
| ADD COLUMN status text | ||
saini-prakhyat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
saini-prakhyat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.