-
Notifications
You must be signed in to change notification settings - Fork 0
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
Easi 4470/dataloaders linked #2674
Conversation
err = sqlutils.WithTransaction(ctx, s.testConfigs.Store, func(tx *sqlx.Tx) error { | ||
return s.testConfigs.Store.SetSystemIntakeSystems(ctx, tx, open1, systemNumbers) | ||
}) | ||
s.NoError(err) | ||
|
||
err = sqlutils.WithTransaction(ctx, s.testConfigs.Store, func(tx *sqlx.Tx) error { | ||
return s.testConfigs.Store.SetSystemIntakeSystems(ctx, tx, open2, systemNumbers) | ||
}) | ||
s.NoError(err) | ||
|
||
err = sqlutils.WithTransaction(ctx, s.testConfigs.Store, func(tx *sqlx.Tx) error { | ||
return s.testConfigs.Store.SetSystemIntakeSystems(ctx, tx, closed, systemNumbers) | ||
}) | ||
s.NoError(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, but these could all be in the same WithTransaction
call, right?
err = sqlutils.WithTransaction(ctx, s.testConfigs.Store, func(tx *sqlx.Tx) error { | |
return s.testConfigs.Store.SetSystemIntakeSystems(ctx, tx, open1, systemNumbers) | |
}) | |
s.NoError(err) | |
err = sqlutils.WithTransaction(ctx, s.testConfigs.Store, func(tx *sqlx.Tx) error { | |
return s.testConfigs.Store.SetSystemIntakeSystems(ctx, tx, open2, systemNumbers) | |
}) | |
s.NoError(err) | |
err = sqlutils.WithTransaction(ctx, s.testConfigs.Store, func(tx *sqlx.Tx) error { | |
return s.testConfigs.Store.SetSystemIntakeSystems(ctx, tx, closed, systemNumbers) | |
}) | |
s.NoError(err) | |
err = sqlutils.WithTransaction(ctx, s.testConfigs.Store, func(tx *sqlx.Tx) error { | |
if err = s.testConfigs.Store.SetSystemIntakeSystems(ctx, tx, open1, systemNumbers); err != nil { | |
return err | |
} | |
if err = s.testConfigs.Store.SetSystemIntakeSystems(ctx, tx, open2, systemNumbers); err != nil { | |
return err | |
} | |
if err = s.testConfigs.Store.SetSystemIntakeSystems(ctx, tx, closed, systemNumbers); err != nil { | |
return err | |
} | |
return nil | |
}) | |
s.NoError(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they could be sure, but i wanted to keep it separate for tests (also easier to know which err occurred, for example)
intake1 := models.SystemIntake{ | ||
EUAUserID: testhelpers.RandomEUAIDNull(), | ||
RequestType: models.SystemIntakeRequestTypeNEW, | ||
State: models.SystemIntakeStateOpen, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is my fault, but there's a helper you can use to shorten this to intake1 := s.createNewIntake()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i need to create a closed one though
trb1 := models.TRBRequest{ | ||
Type: models.TRBTBrainstorm, | ||
State: models.TRBRequestStateOpen, | ||
} | ||
trb1.CreatedBy = testhelpers.RandomEUAIDNull().String | ||
|
||
create1, err := s.testConfigs.Store.CreateTRBRequest(ctx, s.testConfigs.Store, &trb1) | ||
s.NoError(err) | ||
s.NotNil(create1) | ||
|
||
open1 = create1.ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a helper for these as well here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same - i need a closed one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in the Graph Playground and it works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update looks good!
EASI-4470
Description
How to test this change
Cedar/Core/System Summary/Get System
id
of the cedar system you linked the system intake tolinkedSystemIntakes
fieldlinkedSystemIntakes
andlinkedTrbRequests
PR Author Checklist
PR Reviewer Guidelines