Skip to content

Conversation

@KarlG-nbis
Copy link
Contributor

@KarlG-nbis KarlG-nbis commented Oct 28, 2025

Related issue(s) and PR(s)

This PR closes #990.

Description

Implementation of the sda-validator-orchestrator which is responsible for orchestrating the validation of files according to the Validator API specification

How to test

  • Run unit tests

@KarlG-nbis KarlG-nbis self-assigned this Oct 28, 2025
@KarlG-nbis KarlG-nbis force-pushed the feature/validator-orchestrator branch from dfbe13f to f79cb50 Compare October 28, 2025 14:51
@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 47.61905% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.64%. Comparing base (5963077) to head (68e9b41).

Files with missing lines Patch % Lines
sda/internal/database/db_functions.go 45.00% 9 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2057      +/-   ##
==========================================
- Coverage   44.19%   43.64%   -0.56%     
==========================================
  Files          49       48       -1     
  Lines        6956     6849     -107     
==========================================
- Hits         3074     2989      -85     
+ Misses       3504     3491      -13     
+ Partials      378      369       -9     
Flag Coverage Δ
unittests 43.64% <47.61%> (-0.56%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@KarlG-nbis KarlG-nbis force-pushed the feature/validator-orchestrator branch 6 times, most recently from 3a4c6fe to c4183a2 Compare November 3, 2025 08:50
@KarlG-nbis KarlG-nbis marked this pull request as ready for review November 3, 2025 08:50
@KarlG-nbis KarlG-nbis requested a review from a team as a code owner November 3, 2025 08:50
Copy link
Collaborator

@jbygdell jbygdell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are so many thing here that goes against my normal coding principles so i don't know what to do.

More specifically:

  • the use global/shared variables
  • naked functions (no return values)
  • functions that return functions or function wrapped values

Which is maybe why the use of the init() function never has made much sense to me. I prefer implicit calls for that kind of things as it makes for fewer gotcha moments.

Outside of that it looks like a nice proof of concept.

@KarlG-nbis KarlG-nbis force-pushed the feature/validator-orchestrator branch from 24794d1 to 2fb253d Compare November 5, 2025 08:09
jbygdell
jbygdell previously approved these changes Nov 5, 2025
zeidlitz
zeidlitz previously approved these changes Nov 5, 2025
@KarlG-nbis KarlG-nbis dismissed stale reviews from zeidlitz and jbygdell via 2933259 November 10, 2025 08:05
@KarlG-nbis KarlG-nbis force-pushed the feature/validator-orchestrator branch 2 times, most recently from 4854f60 to 1838171 Compare November 18, 2025 08:07
zeidlitz
zeidlitz previously approved these changes Dec 2, 2025
Comment on lines +39 to +53
if err := internalconfig.Load(); err != nil {
log.Fatalf("failed to load config due to: %v", err)
}

if err := validators.Init(config.ValidatorPaths()); err != nil {
log.Fatalf("failed to initialize validators due to: %v", err)
}

amqpBroker, err := broker.NewAMQPBroker()
if err != nil {
log.Fatalf("failed to create new AMPQ broker due to: %v", err)
}

if err := postgres.Init(); err != nil {
log.Fatalf("failed to initialise postgres database due to: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many Fatalf, better to return errors and shutdown gracefully.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is before there is any reason to shutdown gracefully, and eg if broker connection can not be started we do not want to init the pg just to then close it again

mockCommandExecutor *mockCommandExecutor
}

func (ts *ValidatorsTestSuite) SetupTest() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is Init() in validators.go, Init() will be called every time when a test function is run, and therefore, test may pollute each other. Better to reset the global states for validators at the SetupTest(), e.g. Validators = make(map[string]*ValidatorDescription)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow the concern with the init() func, but will add a TearDownTest() to reset the global states after each test

Copy link
Contributor

@nanjiangshu nanjiangshu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @KarlG-nbis! The framework looks nice and and overall logic looks fine to me.
I looked at the README, orchestrator main code, the api and Apptainer parts carefully and left some comments. But for the rest components I haven't reviewed carefully. However, I think we can improve them later on when we go beyond this proof-of-concept.

…http server with TLS, update main.go to react to ctx cancellation if dependants have unexpected error instead of sending of chan for os signals, fix some issues in unit tests
…ate of global(package) variables after each test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants