-
Notifications
You must be signed in to change notification settings - Fork 147
/
Copy pathElasticsearch5Tests.cs
142 lines (127 loc) · 4.97 KB
/
Elasticsearch5Tests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
using System.Collections.Generic;
using System.Linq;
using Datadog.Trace.TestHelpers;
using Xunit;
using Xunit.Abstractions;
#if !NET452
namespace Datadog.Trace.ClrProfiler.IntegrationTests
{
public class Elasticsearch5Tests : TestHelper
{
public Elasticsearch5Tests(ITestOutputHelper output)
: base("Elasticsearch.V5", output)
{
}
[Theory]
[MemberData(nameof(PackageVersions.ElasticSearch5), MemberType = typeof(PackageVersions))]
[Trait("Category", "EndToEnd")]
public void SubmitsTraces(string packageVersion)
{
int agentPort = TcpPortProvider.GetOpenPort();
using (var agent = new MockTracerAgent(agentPort))
using (var processResult = RunSampleAndWaitForExit(agent.Port, packageVersion: packageVersion))
{
Assert.True(processResult.ExitCode >= 0, $"Process exited with code {processResult.ExitCode}");
var expected = new List<string>();
// commands with sync and async
for (var i = 0; i < 2; i++)
{
expected.AddRange(new List<string>
{
"Bulk",
"Create",
"Search",
"DeleteByQuery",
"CreateIndex",
"IndexExists",
"UpdateIndexSettings",
"BulkAlias",
"GetAlias",
"PutAlias",
// "AliasExists",
"DeleteAlias",
"DeleteAlias",
"CreateIndex",
// "SplitIndex",
"DeleteIndex",
"CloseIndex",
"OpenIndex",
"PutIndexTemplate",
"IndexTemplateExists",
"DeleteIndexTemplate",
"IndicesShardStores",
"IndicesStats",
"DeleteIndex",
"GetAlias",
"CatAliases",
"CatAllocation",
"CatCount",
"CatFielddata",
"CatHealth",
"CatHelp",
"CatIndices",
"CatMaster",
"CatNodeAttributes",
"CatNodes",
"CatPendingTasks",
"CatPlugins",
"CatRecovery",
"CatRepositories",
"CatSegments",
"CatShards",
// "CatSnapshots",
"CatTasks",
"CatTemplates",
"CatThreadPool",
// "PutJob",
// "ValidateJob",
// "GetInfluencers",
// "GetJobs",
// "GetJobStats",
// "GetModelSnapshots",
// "GetOverallBuckets",
// "FlushJob",
// "ForecastJob",
// "GetAnomalyRecords",
// "GetBuckets",
// "GetCategories",
// "CloseJob",
// "OpenJob",
// "DeleteJob",
"ClusterAllocationExplain",
"ClusterGetSettings",
"ClusterHealth",
"ClusterPendingTasks",
"ClusterPutSettings",
"ClusterReroute",
"ClusterState",
"ClusterStats",
"PutRole",
// "PutRoleMapping",
"GetRole",
// "GetRoleMapping",
// "DeleteRoleMapping",
"DeleteRole",
"PutUser",
"ChangePassword",
"GetUser",
// "DisableUser",
"DeleteUser",
});
}
var spans = agent.WaitForSpans(expected.Count)
.Where(s => s.Type == "elasticsearch")
.OrderBy(s => s.Start)
.ToList();
foreach (var span in spans)
{
Assert.Equal("elasticsearch.query", span.Name);
Assert.Equal("Samples.Elasticsearch.V5-elasticsearch", span.Service);
Assert.Equal("elasticsearch", span.Type);
}
ValidateSpans(spans, (span) => span.Resource, expected);
}
}
}
}
#endif