mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:37:31 +00:00
feat: query side for executions and targets for actions v2 (#7524)
* feat: add projections and query side to executions and targets * feat: add list and get endpoints for targets * feat: add integration tests for query endpoints target and execution * fix: linting * fix: linting * fix: review changes, renames and corrections * fix: review changes, renames and corrections * fix: review changes, renames and corrections * fix: review changes, renames and corrections * fix: review changes, renames and corrections * fix: review changes, renames and corrections * fix: remove position from list details
This commit is contained in:
@@ -63,9 +63,9 @@ func AssertListDetails[D ListDetailsMsg](t testing.TB, expected, actual D) {
|
||||
return
|
||||
}
|
||||
|
||||
gotCD := gotDetails.GetTimestamp().AsTime()
|
||||
now := time.Now()
|
||||
assert.WithinRange(t, gotCD, now.Add(-time.Minute), now.Add(time.Minute))
|
||||
|
||||
assert.Equal(t, wantDetails.GetTotalResult(), gotDetails.GetTotalResult())
|
||||
|
||||
gotCD := gotDetails.GetTimestamp().AsTime()
|
||||
wantCD := time.Now()
|
||||
assert.WithinRange(t, gotCD, wantCD.Add(-time.Minute), wantCD.Add(time.Minute))
|
||||
}
|
||||
|
@@ -520,7 +520,7 @@ func (s *Tester) CreateProjectMembership(t *testing.T, ctx context.Context, proj
|
||||
}
|
||||
|
||||
func (s *Tester) CreateTarget(ctx context.Context, t *testing.T) *execution.CreateTargetResponse {
|
||||
target, err := s.Client.ExecutionV3.CreateTarget(ctx, &execution.CreateTargetRequest{
|
||||
req := &execution.CreateTargetRequest{
|
||||
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
||||
TargetType: &execution.CreateTargetRequest_RestWebhook{
|
||||
RestWebhook: &execution.SetRESTWebhook{
|
||||
@@ -528,18 +528,42 @@ func (s *Tester) CreateTarget(ctx context.Context, t *testing.T) *execution.Crea
|
||||
},
|
||||
},
|
||||
Timeout: durationpb.New(10 * time.Second),
|
||||
ExecutionType: &execution.CreateTargetRequest_InterruptOnError{
|
||||
InterruptOnError: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
target, err := s.Client.ExecutionV3.CreateTarget(ctx, req)
|
||||
require.NoError(t, err)
|
||||
return target
|
||||
}
|
||||
|
||||
func (s *Tester) SetExecution(ctx context.Context, t *testing.T, cond *execution.SetConditions, targets []string) *execution.SetExecutionResponse {
|
||||
func (s *Tester) CreateTargetWithNameAndType(ctx context.Context, t *testing.T, name string, async bool, interrupt bool) *execution.CreateTargetResponse {
|
||||
req := &execution.CreateTargetRequest{
|
||||
Name: name,
|
||||
TargetType: &execution.CreateTargetRequest_RestWebhook{
|
||||
RestWebhook: &execution.SetRESTWebhook{
|
||||
Url: "https://example.com",
|
||||
},
|
||||
},
|
||||
Timeout: durationpb.New(10 * time.Second),
|
||||
}
|
||||
if async {
|
||||
req.ExecutionType = &execution.CreateTargetRequest_IsAsync{
|
||||
IsAsync: true,
|
||||
}
|
||||
}
|
||||
if interrupt {
|
||||
req.ExecutionType = &execution.CreateTargetRequest_InterruptOnError{
|
||||
InterruptOnError: true,
|
||||
}
|
||||
}
|
||||
target, err := s.Client.ExecutionV3.CreateTarget(ctx, req)
|
||||
require.NoError(t, err)
|
||||
return target
|
||||
}
|
||||
|
||||
func (s *Tester) SetExecution(ctx context.Context, t *testing.T, cond *execution.Condition, targets []string, includes []string) *execution.SetExecutionResponse {
|
||||
target, err := s.Client.ExecutionV3.SetExecution(ctx, &execution.SetExecutionRequest{
|
||||
Condition: cond,
|
||||
Targets: targets,
|
||||
Includes: includes,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
return target
|
||||
|
@@ -318,6 +318,7 @@ func (s *Tester) Done() {
|
||||
//
|
||||
// Note: the database must already be setup and initialized before
|
||||
// using NewTester. See the CONTRIBUTING.md document for details.
|
||||
|
||||
func NewTester(ctx context.Context, zitadelConfigYAML ...string) *Tester {
|
||||
args := strings.Split(commandLine, " ")
|
||||
|
||||
|
Reference in New Issue
Block a user