-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from microsoft/al/test-workflow-geospatial
IntegrationTests and Test Workflow for Geospatial Images Plugin
- Loading branch information
Showing
10 changed files
with
646 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
datagenerators/geospatial-images/plugin/test/integrationTests/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
Oops, something went wrong.