Skip to content

Commit 41047a6

Browse files
committed
Create index in List Tasks API integration test
This commit creates the index in the integration test setup for List tasks, so that Project documents reindexed will have the correct mappings
1 parent c7290cf commit 41047a6

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

src/Tests/Tests/Cluster/TaskManagement/TasksList/TasksListApiTests.cs

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,44 @@ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues
102102
seeder.SeedNode();
103103

104104
// get a suitable load of projects in order to get a decent task status out
105-
var bulkResponse = client.IndexMany(Project.Generator.Generate(20000));
105+
var bulkResponse = client.IndexMany(Project.Generator.Generate(10000));
106106
if (!bulkResponse.IsValid)
107107
throw new Exception("failure in setting up integration");
108108

109+
client.Refresh(typeof(Project));
110+
111+
var targetIndex = "tasks-list-projects";
112+
113+
var createIndex = client.CreateIndex(targetIndex, i => i
114+
.Settings(settings => settings.Analysis(DefaultSeeder.ProjectAnalysisSettings))
115+
.Mappings(m => m
116+
.Map<Project>(mm =>mm
117+
.RoutingField(r => r.Required())
118+
.AutoMap()
119+
.Properties(DefaultSeeder.ProjectProperties)
120+
.Properties<CommitActivity>(props => props
121+
.Object<Developer>(o => o
122+
.AutoMap()
123+
.Name(p => p.Committer)
124+
.Properties(DefaultSeeder.DeveloperProperties)
125+
)
126+
.Text(t => t
127+
.Name(p => p.ProjectName)
128+
.Index(false)
129+
)
130+
)
131+
)
132+
)
133+
);
134+
135+
createIndex.ShouldBeValid();
109136
var response = client.ReindexOnServer(r => r
110137
.Source(s => s
111-
.Index(Infer.Index<Project>())
138+
.Index(typeof(Project))
112139
.Type(typeof(Project))
113140
)
114141
.Destination(d => d
115-
.Index("tasks-list-projects")
142+
.Index(targetIndex)
116143
.OpType(OpType.Create)
117144
)
118145
.Conflicts(Conflicts.Proceed)

0 commit comments

Comments
 (0)