diff --git a/.github/workflows/cpp-tests.yml b/.github/workflows/cpp-tests.yml new file mode 100644 index 00000000..b407fbd9 --- /dev/null +++ b/.github/workflows/cpp-tests.yml @@ -0,0 +1,29 @@ +name: C++ GSDK Tests + +on: + pull_request: + paths: + - 'cpp/**' + - '.github/workflows/cpp-tests.yml' + +permissions: + contents: read + +jobs: + test: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v2 + + - name: Build + run: msbuild cpp\GSDK.sln /t:GSDK_CPP_UnitTests /p:Configuration=Release /p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0 + + - name: Test + shell: pwsh + run: | + $env:PATH += ";$pwd\cpp\dependencies\libcurl-vc15-x64-release-dll-ssl-dll-ipv6-sspi\bin;$pwd\cpp\dependencies\openssl" + $vsInstallPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath + & "$vsInstallPath\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "cpp\x64\Release\GSDKCPPUnitTests\GSDK_CPP_UnitTests.dll" /Platform:x64 diff --git a/cpp/unittests/gsdkTests.cpp b/cpp/unittests/gsdkTests.cpp index 6581fad7..8350afd3 100644 --- a/cpp/unittests/gsdkTests.cpp +++ b/cpp/unittests/gsdkTests.cpp @@ -193,22 +193,22 @@ namespace Microsoft }, "maintenanceSchedule": { - "DocumentIncarnation": "IncarnationID", + "documentIncarnation": "IncarnationID", "Events": [ { - "EventId": "eventID", - "EventType": "Reboot", - "ResourceType": "VirtualMachine", + "eventId": "eventID", + "eventType": "Reboot", + "resourceType": "VirtualMachine", "Resources": [ "resourceName" ], - "EventStatus": "Scheduled", - "NotBefore": "2018-04-12T16:58:30.1458776Z", - "Description": "eventDescription", - "EventSource": "Platform", - "DurationInSeconds": 3600 + "eventStatus": "Scheduled", + "notBefore": "2018-04-12T16:58:30.1458776Z", + "description": "eventDescription", + "eventSource": "Platform", + "durationInSeconds": 3600 } ] }, @@ -227,7 +227,7 @@ namespace Microsoft Assert::AreEqual(1523552310LL, _mkgmtime(&schedule.m_events[0].m_notBefore), L"Verify maintenance V2 callback with correct time was called."); Assert::AreEqual("eventDescription", schedule.m_events[0].m_description.c_str(), L"Verify maintenance V2 callback with correct description was called."); Assert::AreEqual("Platform", schedule.m_events[0].m_eventSource.c_str(), L"Verify maintenance V2 callback with correct source was called."); - Assert::AreEqual(3600, schedule.m_events[0].m_durationInSeconds, L"Verify maintenance V2 callback with correct duration was called."); + Assert::AreEqual(3600u, schedule.m_events[0].m_durationInSeconds, L"Verify maintenance V2 callback with correct duration was called."); } TEST_METHOD(DecodeAgentResponse_JsonDoesntCrash)