Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntegrationTests and Test Workflow for Geospatial Images Plugin #17

Merged
merged 5 commits into from
Aug 1, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/geospatial-images-plugin-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: test-geospatial-images-plugin

on:
workflow_dispatch:
pull_request:
branches: [ main ]
paths:
- 'datagenerators/geospatial-images/plugin/**'
- '.github/workflows/geospatial-images-plugin-test.yaml'


jobs:
test-geospatial-images-plugin-amd64:
permissions:
contents: read
issues: read
checks: write
pull-requests: write

uses: microsoft/azure-orbital-space-sdk-github-actions/.github/workflows/test-plugin.yaml@main
with:
APP_NAME: vth
PLUGIN_NAME: geospatial-images-vth-plugin
WORKFLOW_AGENT: ubuntu-latest
DEVCONTAINER_JSON: ./.devcontainer/geospatial-images-vth-plugin/devcontainer.json
REPO_DIR: ./datagenerators/geospatial-images/plugin
secrets:
GIT_HUB_USER_NAME: ${{ secrets.GIT_HUB_USER_NAME }}
GIT_HUB_USER_TOKEN: ${{ secrets.GIT_HUB_USER_TOKEN }}
SETUP_REPO_URL: ${{ secrets.SETUP_REPO_URL }}


test-geospatial-images-plugin-arm64:
permissions:
contents: read
issues: read
checks: write
pull-requests: write

uses: microsoft/azure-orbital-space-sdk-github-actions/.github/workflows/test-plugin.yaml@main
with:
APP_NAME: vth
PLUGIN_NAME: geospatial-images-vth-plugin
WORKFLOW_AGENT: spacesdk-ubuntu-2204LTS-arm64
DEVCONTAINER_JSON: ./.devcontainer/geospatial-images-vth-plugin/devcontainer.json
REPO_DIR: ./datagenerators/geospatial-images/plugin
secrets:
GIT_HUB_USER_NAME: ${{ secrets.GIT_HUB_USER_NAME }}
GIT_HUB_USER_TOKEN: ${{ secrets.GIT_HUB_USER_TOKEN }}
SETUP_REPO_URL: ${{ secrets.SETUP_REPO_URL }}
123 changes: 122 additions & 1 deletion datagenerators/geospatial-images/plugin/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,102 @@
"order": 1
},
"requireExactSource": true
}
},
{
"name": "Integration Tests - Client Debug",
"type": "coreclr",
"request": "launch",
"program": "/usr/bin/dotnet",
"preLaunchTask": "deploy-debugshim-integrationTest",
"args": [
"${workspaceFolder}/test/integrationTests/bin/Debug/net6.0/integrationTests.dll"
],
"env": {
"DOTNET_ENVIRONMENT": "Development"
},
"cwd": "${workspaceFolder}/test/integrationTests",
"stopAtEntry": false,
"console": "internalConsole",
"pipeTransport": {
"pipeCwd": "${workspaceRoot}/test/integrationTests",
"pipeProgram": "bash",
"pipeArgs": [
"-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 -- "
],
"quoteArgs": false,
"debuggerPath": "${workspaceFolder}/.git/spacefx-dev/vsdbg/vsdbg"
},
"postDebugTask": "reset-debugshim-client",
"presentation": {
"hidden": false,
"group": "integrationtests",
"order": 1
},
"requireExactSource": true
},
{
"name": "Integration Tests - Client Run",
"type": "coreclr",
"request": "launch",
"program": "/usr/bin/dotnet",
"preLaunchTask": "deploy-debugshim-integrationTest",
"args": [
"test",
"--verbosity",
"detailed",
"${workspaceRoot}/test/integrationTests/bin/Debug/net6.0/integrationTests.dll"
],
"cwd": "${workspaceFolder}/test/integrationTests",
"stopAtEntry": false,
"console": "internalConsole",
"pipeTransport": {
"pipeCwd": "${workspaceRoot}/test/integrationTests",
"pipeProgram": "bash",
"pipeArgs": [
"-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 -- "
],
"quoteArgs": false,
"debuggerPath": "${workspaceFolder}/.git/spacefx-dev/vsdbg/vsdbg"
},
"postDebugTask": "reset-debugshim-client",
"presentation": {
"hidden": true,
"group": "integrationtests",
"order": 2
},
},
{
"name": "Integration Tests - vth",
"type": "coreclr",
"request": "launch",
"program": "/usr/bin/dotnet",
"preLaunchTask": "deploy-debugshim-integrationTest-host",
"args": [
"${workspaceFolder}/.git/workspaces/vth/vth.dll"
],
"env": {
"DOTNET_ENVIRONMENT": "IntegrationTest"
},
"cwd": "${workspaceFolder}/src",
"stopAtEntry": false,
"console": "internalConsole",
"pipeTransport": {
"pipeCwd": "${workspaceRoot}/src",
"pipeProgram": "bash",
"pipeArgs": [
"-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 -- "
],
"quoteArgs": false,
"debuggerPath": "${workspaceFolder}/.git/spacefx-dev/vsdbg/vsdbg"
},
"postDebugTask": "reset-debugshim-host",
"presentation": {
"hidden": false,
"group": "integrationtests",
"order": 1
},
"requireExactSource": true
},
],
"compounds": [
{
Expand All @@ -79,6 +174,32 @@
"group": "debug",
"order": 2
}
},
{
"name": "Integration Tests - Debug",
"configurations": [
"Integration Tests - vth",
"Integration Tests - Client Debug"
],
"stopAll": true,
"presentation": {
"hidden": false,
"group": "integrationtests",
"order": 3
}
},
{
"name": "Integration Tests - Run",
"configurations": [
"Integration Tests - vth",
"Integration Tests - Client Run"
],
"stopAll": true,
"presentation": {
"hidden": false,
"group": "integrationtests",
"order": 3
}
}
]
}
53 changes: 46 additions & 7 deletions datagenerators/geospatial-images/plugin/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"command": "/bin/bash",
"type": "shell",
"dependsOn": [
"build",
"build"
],
"dependsOrder": "sequence",
"args": [
Expand Down Expand Up @@ -122,19 +122,58 @@
"problemMatcher": "$msCompile"
},
{
"label": "reset-debugshim-test-client",
"isBackground": true,
"label": "deploy-debugshim-integrationTest",
"isBackground": false,
"command": "/bin/bash",
"type": "shell",
"dependsOn": [
"build-integrationTest"
],
"dependsOrder": "sequence",
"args": [
"/spacefx-dev/debugShim-reset.sh",
"/spacefx-dev/debugShim-deploy.sh",
"--debug_shim",
"${DEBUG_SHIM_CLIENT}",
"--skip-pod-wait"
"${DEBUG_SHIM_CLIENT}"
],
"presentation": {
"echo": false,
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
}
},
{
"label": "build-integrationTest",
"command": "dotnet",
"type": "process",
"dependsOn": "pause-processing",
"args": [
"build",
"${workspaceFolder}/test/integrationTests/integrationTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"--property:Debug=portable"
],
"problemMatcher": "$msCompile"
},
{
"label": "deploy-debugshim-integrationTest-host",
"isBackground": false,
"command": "/bin/bash",
"type": "shell",
"dependsOn": [
"build"
],
"dependsOrder": "sequence",
"args": [
"/spacefx-dev/debugShim-deploy.sh",
"--debug_shim",
"${DEBUG_SHIM_HOST}"
],
"presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace Microsoft.Azure.SpaceFx.VTH.IntegrationTests;

public class Program
{
internal static TestSharedContext TEST_SHARED_CONTEXT = new();
public static void Main(string[] args)
{
Console.WriteLine("--------- Starting Tests ---------");
RunTests<Tests.TaskingTests>();
RunTests<Tests.SensorsAvailableTests>();
Console.WriteLine("--------- All Tests successful ---------");
}

// Dynamically loop through tests and call them
private static void RunTests<T>()
{
T? testWrapper = (T)Activator.CreateInstance(typeof(T), new object[] { TEST_SHARED_CONTEXT });

Console.WriteLine($"...Test Class: {testWrapper.GetType().Name}: START");

// Get all the methods from ProtoTests that are using the Fact attribute
var methods = Assembly.GetExecutingAssembly().GetTypes()
.Where(t => t.FullName == typeof(T).FullName)
.SelectMany(t => t.GetMethods())
.Where(m => m.GetCustomAttributes(typeof(FactAttribute), false).Length > 0)
.ToArray();

// Loop through what we found and run the test
foreach (var testMethod in methods)
{
Console.WriteLine($"......Test '{testWrapper.GetType().Name} / {testMethod.Name}': START...");
Task task = (Task)testMethod.DeclaringType?.GetMethod(testMethod.Name)?.Invoke(testWrapper, null)!;
task.Wait();
Console.WriteLine($"......Test '{testWrapper.GetType().Name} / {testMethod.Name}': SUCCESS");
}

Console.WriteLine($"...Test Class: {testWrapper.GetType().Name}: END");
}
}
Loading
Loading