Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Revert "List work items part of child iterations (#2146)" #2168

Merged
merged 1 commit into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
213 changes: 0 additions & 213 deletions controller/search_blackbox_test.go
Expand Up @@ -1033,219 +1033,6 @@ func (s *searchControllerTestSuite) TestSearchByJoinedData() {
})
}

// TestSearchWorkItemsWithChildIterationsOption verifies the Included list of parents
func (s *searchControllerTestSuite) TestSearchWorkItemsWithChildIterationsOption() {
s.T().Run("iterations", func(t *testing.T) {
fxt := tf.NewTestFixture(t, s.DB,
tf.Iterations(3, func(fxt *tf.TestFixture, idx int) error {
i := fxt.Iterations[idx]
switch idx {
case 0:
i.Name = "Top level iteration"
case 1:
i.Name = "Level 1 iteration"
i.MakeChildOf(*fxt.Iterations[idx-1])
case 2:
i.Name = "Level 2 iteration"
i.MakeChildOf(*fxt.Iterations[idx-1])
}
return nil
}),

tf.WorkItems(10, func(fxt *tf.TestFixture, idx int) error {
switch idx {
case 0, 1, 2:
fxt.WorkItems[idx].Fields[workitem.SystemIteration] = fxt.Iterations[0].ID.String()
case 3, 4:
fxt.WorkItems[idx].Fields[workitem.SystemIteration] = fxt.Iterations[1].ID.String()
case 5, 6, 7, 8:
fxt.WorkItems[idx].Fields[workitem.SystemIteration] = fxt.Iterations[2].ID.String()
}
return nil
}),
)

spaceIDStr := fxt.Spaces[0].ID.String()

t.Run("without child iteration", func(t *testing.T) {
filter := fmt.Sprintf(`{"iteration": "%s", "$OPTS":{"child-iterations": true}}`, fxt.Iterations[2].ID)
_, result := test.ShowSearchOK(t, nil, nil, s.controller, &filter, nil, nil, nil, nil, &spaceIDStr)
require.NotEmpty(t, result.Data)
assert.Len(t, result.Data, 4)
toBeFound := id.MapFromSlice(id.Slice{
fxt.WorkItems[5].ID,
fxt.WorkItems[6].ID,
fxt.WorkItems[7].ID,
fxt.WorkItems[8].ID,
})
for _, wi := range result.Data {
_, ok := toBeFound[*wi.ID]
require.True(t, ok, "unknown work item found: %s", *wi.ID)
delete(toBeFound, *wi.ID)
}
require.Empty(t, toBeFound, "failed to found all work items: %+s", toBeFound)
})
t.Run("with one child iteration", func(t *testing.T) {
filter := fmt.Sprintf(`{"iteration": "%s", "$OPTS":{"child-iterations": true}}`, fxt.Iterations[1].ID)
_, result := test.ShowSearchOK(t, nil, nil, s.controller, &filter, nil, nil, nil, nil, &spaceIDStr)
require.NotEmpty(t, result.Data)
assert.Len(t, result.Data, 6)
toBeFound := id.MapFromSlice(id.Slice{
fxt.WorkItems[3].ID,
fxt.WorkItems[4].ID,
fxt.WorkItems[5].ID,
fxt.WorkItems[6].ID,
fxt.WorkItems[7].ID,
fxt.WorkItems[8].ID,
})
for _, wi := range result.Data {
_, ok := toBeFound[*wi.ID]
require.True(t, ok, "unknown work item found: %s", *wi.ID)
delete(toBeFound, *wi.ID)
}
require.Empty(t, toBeFound, "failed to found all work items: %+s", toBeFound)
})
t.Run("with two child iteration", func(t *testing.T) {
filter := fmt.Sprintf(`{"iteration": "%s", "$OPTS":{"child-iterations": true}}`, fxt.Iterations[0].ID)
_, result := test.ShowSearchOK(t, nil, nil, s.controller, &filter, nil, nil, nil, nil, &spaceIDStr)
require.NotEmpty(t, result.Data)
assert.Len(t, result.Data, 9)
toBeFound := id.MapFromSlice(id.Slice{
fxt.WorkItems[0].ID,
fxt.WorkItems[1].ID,
fxt.WorkItems[2].ID,
fxt.WorkItems[3].ID,
fxt.WorkItems[4].ID,
fxt.WorkItems[5].ID,
fxt.WorkItems[6].ID,
fxt.WorkItems[7].ID,
fxt.WorkItems[8].ID,
})
for _, wi := range result.Data {
_, ok := toBeFound[*wi.ID]
require.True(t, ok, "unknown work item found: %s", *wi.ID)
delete(toBeFound, *wi.ID)
}
require.Empty(t, toBeFound, "failed to found all work items: %+s", toBeFound)
})

t.Run("without child iteration - implicit", func(t *testing.T) {
filter := fmt.Sprintf(`{"iteration": "%s"}`, fxt.Iterations[2].ID)
_, result := test.ShowSearchOK(t, nil, nil, s.controller, &filter, nil, nil, nil, nil, &spaceIDStr)
require.NotEmpty(t, result.Data)
assert.Len(t, result.Data, 4)
toBeFound := id.MapFromSlice(id.Slice{
fxt.WorkItems[5].ID,
fxt.WorkItems[6].ID,
fxt.WorkItems[7].ID,
fxt.WorkItems[8].ID,
})
for _, wi := range result.Data {
_, ok := toBeFound[*wi.ID]
require.True(t, ok, "unknown work item found: %s", *wi.ID)
delete(toBeFound, *wi.ID)
}
require.Empty(t, toBeFound, "failed to found all work items: %+s", toBeFound)
})
t.Run("with one child iteration - implicit", func(t *testing.T) {
filter := fmt.Sprintf(`{"iteration": "%s"}`, fxt.Iterations[1].ID)
_, result := test.ShowSearchOK(t, nil, nil, s.controller, &filter, nil, nil, nil, nil, &spaceIDStr)
require.NotEmpty(t, result.Data)
assert.Len(t, result.Data, 6)
toBeFound := id.MapFromSlice(id.Slice{
fxt.WorkItems[3].ID,
fxt.WorkItems[4].ID,
fxt.WorkItems[5].ID,
fxt.WorkItems[6].ID,
fxt.WorkItems[7].ID,
fxt.WorkItems[8].ID,
})
for _, wi := range result.Data {
_, ok := toBeFound[*wi.ID]
require.True(t, ok, "unknown work item found: %s", *wi.ID)
delete(toBeFound, *wi.ID)
}
require.Empty(t, toBeFound, "failed to found all work items: %+s", toBeFound)
})
t.Run("with two child iteration - implicit", func(t *testing.T) {
filter := fmt.Sprintf(`{"iteration": "%s"}`, fxt.Iterations[0].ID)
_, result := test.ShowSearchOK(t, nil, nil, s.controller, &filter, nil, nil, nil, nil, &spaceIDStr)
require.NotEmpty(t, result.Data)
assert.Len(t, result.Data, 9)
toBeFound := id.MapFromSlice(id.Slice{
fxt.WorkItems[0].ID,
fxt.WorkItems[1].ID,
fxt.WorkItems[2].ID,
fxt.WorkItems[3].ID,
fxt.WorkItems[4].ID,
fxt.WorkItems[5].ID,
fxt.WorkItems[6].ID,
fxt.WorkItems[7].ID,
fxt.WorkItems[8].ID,
})
for _, wi := range result.Data {
_, ok := toBeFound[*wi.ID]
require.True(t, ok, "unknown work item found: %s", *wi.ID)
delete(toBeFound, *wi.ID)
}
require.Empty(t, toBeFound, "failed to found all work items: %+s", toBeFound)
})

t.Run("without child iteration - false option", func(t *testing.T) {
filter := fmt.Sprintf(`{"iteration": "%s", "$OPTS":{"child-iterations": false}}`, fxt.Iterations[2].ID)
_, result := test.ShowSearchOK(t, nil, nil, s.controller, &filter, nil, nil, nil, nil, &spaceIDStr)
require.NotEmpty(t, result.Data)
assert.Len(t, result.Data, 4)
toBeFound := id.MapFromSlice(id.Slice{
fxt.WorkItems[5].ID,
fxt.WorkItems[6].ID,
fxt.WorkItems[7].ID,
fxt.WorkItems[8].ID,
})
for _, wi := range result.Data {
_, ok := toBeFound[*wi.ID]
require.True(t, ok, "unknown work item found: %s", *wi.ID)
delete(toBeFound, *wi.ID)
}
require.Empty(t, toBeFound, "failed to found all work items: %+s", toBeFound)
})
t.Run("with one child iteration - false option", func(t *testing.T) {
filter := fmt.Sprintf(`{"iteration": "%s", "$OPTS":{"child-iterations": false}}`, fxt.Iterations[1].ID)
_, result := test.ShowSearchOK(t, nil, nil, s.controller, &filter, nil, nil, nil, nil, &spaceIDStr)
require.NotEmpty(t, result.Data)
assert.Len(t, result.Data, 2)
toBeFound := id.MapFromSlice(id.Slice{
fxt.WorkItems[3].ID,
fxt.WorkItems[4].ID,
})
for _, wi := range result.Data {
_, ok := toBeFound[*wi.ID]
require.True(t, ok, "unknown work item found: %s", *wi.ID)
delete(toBeFound, *wi.ID)
}
require.Empty(t, toBeFound, "failed to found all work items: %+s", toBeFound)
})
t.Run("with two child iteration - false option", func(t *testing.T) {
filter := fmt.Sprintf(`{"iteration": "%s", "$OPTS":{"child-iterations": false}}`, fxt.Iterations[0].ID)
_, result := test.ShowSearchOK(t, nil, nil, s.controller, &filter, nil, nil, nil, nil, &spaceIDStr)
require.NotEmpty(t, result.Data)
assert.Len(t, result.Data, 3)
toBeFound := id.MapFromSlice(id.Slice{
fxt.WorkItems[0].ID,
fxt.WorkItems[1].ID,
fxt.WorkItems[2].ID,
})
for _, wi := range result.Data {
_, ok := toBeFound[*wi.ID]
require.True(t, ok, "unknown work item found: %s", *wi.ID)
delete(toBeFound, *wi.ID)
}
require.Empty(t, toBeFound, "failed to found all work items: %+s", toBeFound)
})
})

}

// TestIncludedParents verifies the Included list of parents
func (s *searchControllerTestSuite) TestIncludedParents() {

Expand Down
2 changes: 1 addition & 1 deletion query/query.go
Expand Up @@ -90,7 +90,7 @@ func (r *GormQueryRepository) Create(ctx context.Context, q *Query) error {
return errors.NewBadParameterError("query field is invalid JSON syntax", q.Fields).Expected("valid JSON")
}
// Parse fields to make sure that query is valid
exp, _, _, err := search.ParseFilterString(ctx, q.Fields)
exp, _, err := search.ParseFilterString(ctx, q.Fields)
if err != nil || exp == nil {
log.Error(ctx, map[string]interface{}{
"space_id": q.SpaceID,
Expand Down