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:
Stefan Benz
2024-03-14 10:56:23 +01:00
committed by GitHub
parent 5d2cfc06d5
commit fb3c6f791b
30 changed files with 3266 additions and 326 deletions

View File

@@ -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))
}

View File

@@ -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

View File

@@ -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, " ")