Skip to content

Commit e1d747b

Browse files
alexlianidesalianides
and
alianides
authored
integrationTest suite for plugin (#15)
Co-authored-by: alianides <[email protected]>
1 parent 42c628b commit e1d747b

File tree

9 files changed

+599
-7
lines changed

9 files changed

+599
-7
lines changed

datagenerators/planetary-computer/plugin/.vscode/launch.json

+122-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,102 @@
6464
"order": 1
6565
},
6666
"requireExactSource": true
67-
}
67+
},
68+
{
69+
"name": "Integration Tests - Client Debug",
70+
"type": "coreclr",
71+
"request": "launch",
72+
"program": "/usr/bin/dotnet",
73+
"preLaunchTask": "deploy-debugshim-integrationTest",
74+
"args": [
75+
"${workspaceFolder}/test/integrationTests/bin/Debug/net6.0/integrationTests.dll"
76+
],
77+
"env": {
78+
"DOTNET_ENVIRONMENT": "Development"
79+
},
80+
"cwd": "${workspaceFolder}/test/integrationTests",
81+
"stopAtEntry": false,
82+
"console": "internalConsole",
83+
"pipeTransport": {
84+
"pipeCwd": "${workspaceRoot}/test/integrationTests",
85+
"pipeProgram": "bash",
86+
"pipeArgs": [
87+
"-c \" kubectl exec --stdin $(kubectl get pods -l app=vth-client -n payload-app --sort-by=.metadata.creationTimestamp -o jsonpath=\"{.items[-1:].metadata.name}\") -n payload-app -c vth-client -- "
88+
],
89+
"quoteArgs": false,
90+
"debuggerPath": "${workspaceFolder}/.git/spacefx-dev/vsdbg/vsdbg"
91+
},
92+
"postDebugTask": "reset-debugshim-client",
93+
"presentation": {
94+
"hidden": false,
95+
"group": "integrationtests",
96+
"order": 1
97+
},
98+
"requireExactSource": true
99+
},
100+
{
101+
"name": "Integration Tests - Client Run",
102+
"type": "coreclr",
103+
"request": "launch",
104+
"program": "/usr/bin/dotnet",
105+
"preLaunchTask": "deploy-debugshim-integrationTest",
106+
"args": [
107+
"test",
108+
"--verbosity",
109+
"detailed",
110+
"${workspaceRoot}/test/integrationTests/bin/Debug/net6.0/integrationTests.dll"
111+
],
112+
"cwd": "${workspaceFolder}/test/integrationTests",
113+
"stopAtEntry": false,
114+
"console": "internalConsole",
115+
"pipeTransport": {
116+
"pipeCwd": "${workspaceRoot}/test/integrationTests",
117+
"pipeProgram": "bash",
118+
"pipeArgs": [
119+
"-c \" kubectl exec --stdin $(kubectl get pods -l app=vth-client -n payload-app --sort-by=.metadata.creationTimestamp -o jsonpath=\"{.items[-1:].metadata.name}\") -n payload-app -c vth-client -- "
120+
],
121+
"quoteArgs": false,
122+
"debuggerPath": "${workspaceFolder}/.git/spacefx-dev/vsdbg/vsdbg"
123+
},
124+
"postDebugTask": "reset-debugshim-client",
125+
"presentation": {
126+
"hidden": true,
127+
"group": "integrationtests",
128+
"order": 2
129+
},
130+
},
131+
{
132+
"name": "Integration Tests - vth",
133+
"type": "coreclr",
134+
"request": "launch",
135+
"program": "/usr/bin/dotnet",
136+
"preLaunchTask": "deploy-debugshim-integrationTest-host",
137+
"args": [
138+
"${workspaceFolder}/.git/workspaces/vth/vth.dll"
139+
],
140+
"env": {
141+
"DOTNET_ENVIRONMENT": "IntegrationTest"
142+
},
143+
"cwd": "${workspaceFolder}/src",
144+
"stopAtEntry": false,
145+
"console": "internalConsole",
146+
"pipeTransport": {
147+
"pipeCwd": "${workspaceRoot}/src",
148+
"pipeProgram": "bash",
149+
"pipeArgs": [
150+
"-c \" kubectl exec --stdin $(kubectl get pods -l app=vth -n payload-app --sort-by=.metadata.creationTimestamp -o jsonpath=\"{.items[-1:].metadata.name}\") -n payload-app -c vth -- "
151+
],
152+
"quoteArgs": false,
153+
"debuggerPath": "${workspaceFolder}/.git/spacefx-dev/vsdbg/vsdbg"
154+
},
155+
"postDebugTask": "reset-debugshim-host",
156+
"presentation": {
157+
"hidden": false,
158+
"group": "integrationtests",
159+
"order": 1
160+
},
161+
"requireExactSource": true
162+
},
68163
],
69164
"compounds": [
70165
{
@@ -79,6 +174,32 @@
79174
"group": "debug",
80175
"order": 2
81176
}
177+
},
178+
{
179+
"name": "Integration Tests - Debug",
180+
"configurations": [
181+
"Integration Tests - vth",
182+
"Integration Tests - Client Debug"
183+
],
184+
"stopAll": true,
185+
"presentation": {
186+
"hidden": false,
187+
"group": "integrationtests",
188+
"order": 3
189+
}
190+
},
191+
{
192+
"name": "Integration Tests - Run",
193+
"configurations": [
194+
"Integration Tests - vth",
195+
"Integration Tests - Client Run"
196+
],
197+
"stopAll": true,
198+
"presentation": {
199+
"hidden": false,
200+
"group": "integrationtests",
201+
"order": 3
202+
}
82203
}
83204
]
84205
}

datagenerators/planetary-computer/plugin/.vscode/tasks.json

+45-6
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,58 @@
122122
"problemMatcher": "$msCompile"
123123
},
124124
{
125-
"label": "reset-debugshim-test-client",
126-
"isBackground": true,
125+
"label": "deploy-debugshim-integrationTest",
126+
"isBackground": false,
127127
"command": "/bin/bash",
128128
"type": "shell",
129+
"dependsOn": [
130+
"build-integrationTest"
131+
],
129132
"dependsOrder": "sequence",
130133
"args": [
131-
"/spacefx-dev/debugShim-reset.sh",
134+
"/spacefx-dev/debugShim-deploy.sh",
132135
"--debug_shim",
133-
"${DEBUG_SHIM_CLIENT}",
134-
"--skip-pod-wait"
136+
"${DEBUG_SHIM_CLIENT}"
135137
],
136138
"presentation": {
137-
"echo": false,
139+
"echo": true,
140+
"reveal": "never",
141+
"focus": false,
142+
"panel": "shared",
143+
"showReuseMessage": false,
144+
"clear": false
145+
}
146+
},
147+
{
148+
"label": "build-integrationTest",
149+
"command": "dotnet",
150+
"type": "process",
151+
"dependsOn": "pause-processing",
152+
"args": [
153+
"build",
154+
"${workspaceFolder}/test/integrationTests/integrationTests.csproj",
155+
"/property:GenerateFullPaths=true",
156+
"/consoleloggerparameters:NoSummary",
157+
"--property:Debug=portable"
158+
],
159+
"problemMatcher": "$msCompile"
160+
},
161+
{
162+
"label": "deploy-debugshim-integrationTest-host",
163+
"isBackground": false,
164+
"command": "/bin/bash",
165+
"type": "shell",
166+
"dependsOn": [
167+
"build"
168+
],
169+
"dependsOrder": "sequence",
170+
"args": [
171+
"/spacefx-dev/debugShim-deploy.sh",
172+
"--debug_shim",
173+
"${DEBUG_SHIM_HOST}"
174+
],
175+
"presentation": {
176+
"echo": true,
138177
"reveal": "never",
139178
"focus": false,
140179
"panel": "shared",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace Microsoft.Azure.SpaceFx.VTH.IntegrationTests;
2+
3+
public class Program
4+
{
5+
internal static TestSharedContext TEST_SHARED_CONTEXT = new();
6+
public static void Main(string[] args)
7+
{
8+
Console.WriteLine("--------- Starting Tests ---------");
9+
RunTests<Tests.TaskingTests>();
10+
RunTests<Tests.SensorsAvailableTests>();
11+
Console.WriteLine("--------- All Tests successful ---------");
12+
}
13+
14+
// Dynamically loop through tests and call them
15+
private static void RunTests<T>()
16+
{
17+
T? testWrapper = (T)Activator.CreateInstance(typeof(T), new object[] { TEST_SHARED_CONTEXT });
18+
19+
Console.WriteLine($"...Test Class: {testWrapper.GetType().Name}: START");
20+
21+
// Get all the methods from ProtoTests that are using the Fact attribute
22+
var methods = Assembly.GetExecutingAssembly().GetTypes()
23+
.Where(t => t.FullName == typeof(T).FullName)
24+
.SelectMany(t => t.GetMethods())
25+
.Where(m => m.GetCustomAttributes(typeof(FactAttribute), false).Length > 0)
26+
.ToArray();
27+
28+
// Loop through what we found and run the test
29+
foreach (var testMethod in methods)
30+
{
31+
Console.WriteLine($"......Test '{testWrapper.GetType().Name} / {testMethod.Name}': START...");
32+
Task task = (Task)testMethod.DeclaringType?.GetMethod(testMethod.Name)?.Invoke(testWrapper, null)!;
33+
task.Wait();
34+
Console.WriteLine($"......Test '{testWrapper.GetType().Name} / {testMethod.Name}': SUCCESS");
35+
}
36+
37+
Console.WriteLine($"...Test Class: {testWrapper.GetType().Name}: END");
38+
}
39+
}

0 commit comments

Comments
 (0)