Refactor test files for improved readability and consistency
- Adjusted indentation and formatting in `trace_concurrent_test.go` and `trace_node_test.go` to enhance code clarity. - Ensured consistent structure in test cases by aligning the setup and assertions, improving overall maintainability.
This commit is contained in:
parent
47a35b7e63
commit
251b0591a2
2 changed files with 18 additions and 18 deletions
|
|
@ -18,17 +18,17 @@ func TestConcurrentNodeOperations(t *testing.T) {
|
|||
t.Run(d.Name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
traceID, manager, err := trace.New(ctx, d.DriverType, nil, d.DriverOptions...)
|
||||
assert.NoError(t, err)
|
||||
defer trace.Release(traceID)
|
||||
defer trace.Remove(ctx, d.DriverType, traceID, d.DriverOptions...)
|
||||
traceID, manager, err := trace.New(ctx, d.DriverType, nil, d.DriverOptions...)
|
||||
assert.NoError(t, err)
|
||||
defer trace.Release(traceID)
|
||||
defer trace.Remove(ctx, d.DriverType, traceID, d.DriverOptions...)
|
||||
|
||||
// Add first node as root
|
||||
_, err = manager.Add("root", types.TraceNodeOption{Label: "Root"})
|
||||
assert.NoError(t, err)
|
||||
// Add first node as root
|
||||
_, err = manager.Add("root", types.TraceNodeOption{Label: "Root"})
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Create parallel nodes
|
||||
nodes, err := manager.Parallel([]types.TraceParallelInput{
|
||||
// Create parallel nodes
|
||||
nodes, err := manager.Parallel([]types.TraceParallelInput{
|
||||
{Input: "task 1", Option: types.TraceNodeOption{Label: "Worker 1"}},
|
||||
{Input: "task 2", Option: types.TraceNodeOption{Label: "Worker 2"}},
|
||||
{Input: "task 3", Option: types.TraceNodeOption{Label: "Worker 3"}},
|
||||
|
|
|
|||
|
|
@ -73,17 +73,17 @@ func TestParallelOperations(t *testing.T) {
|
|||
t.Run(d.Name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
traceID, manager, err := trace.New(ctx, d.DriverType, nil, d.DriverOptions...)
|
||||
assert.NoError(t, err)
|
||||
defer trace.Release(traceID)
|
||||
defer trace.Remove(ctx, d.DriverType, traceID, d.DriverOptions...)
|
||||
traceID, manager, err := trace.New(ctx, d.DriverType, nil, d.DriverOptions...)
|
||||
assert.NoError(t, err)
|
||||
defer trace.Release(traceID)
|
||||
defer trace.Remove(ctx, d.DriverType, traceID, d.DriverOptions...)
|
||||
|
||||
// Add first node as root
|
||||
_, err = manager.Add("root", types.TraceNodeOption{Label: "Root"})
|
||||
assert.NoError(t, err)
|
||||
// Add first node as root
|
||||
_, err = manager.Add("root", types.TraceNodeOption{Label: "Root"})
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Create parallel nodes
|
||||
nodes, err := manager.Parallel([]types.TraceParallelInput{
|
||||
// Create parallel nodes
|
||||
nodes, err := manager.Parallel([]types.TraceParallelInput{
|
||||
{
|
||||
Input: "task A",
|
||||
Option: types.TraceNodeOption{Label: "Worker A", Icon: "cpu"},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue