@@ -52,48 +52,64 @@ jobs:
5252
5353 integration-test-with-cosmos :
5454 name : Integration testing with the Consensus Commit transaction manager on Cosmos DB
55- runs-on : ubuntu -latest-l
55+ runs-on : windows -latest
5656
5757 steps :
5858 - name : Checkout the target repository
5959 uses : actions/checkout@v4
6060 with :
6161 ref : ${{ inputs.target-ref }}
6262
63- - name : Prepare own schema.json
64- id : schema
65- run : |
66- SUFFIX=$(echo "_${{ inputs.target-ref }}" | tr '.' '_')
67- sed -i s/scalar/scalar${SUFFIX}/ ledger/scripts/create_schema.json
68- sed -i s/test/test${SUFFIX}/ ledger/scripts/create_schema_function.json
69- echo "namespace_suffix=${SUFFIX}" >> $GITHUB_OUTPUT
70-
7163 - name : Set up JDK 1.8
7264 uses : actions/setup-java@v4
7365 with :
7466 distribution : ' temurin'
7567 java-version : ' 8'
7668
69+ - name : Start Azure Cosmos DB emulator
70+ run : |
71+ Write-Host "Launching Cosmos DB Emulator"
72+ Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
73+ # Set startup timeout to 10min (600s), the default is 4min
74+ Start-CosmosDbEmulator -Consistency Strong -Timeout 600
75+
76+ - name : Install TLS/SSL certificate
77+ run : |
78+ $cert = Get-ChildItem Cert:\LocalMachine\My | where{$_.FriendlyName -eq 'DocumentDbEmulatorCertificate'}
79+ $params = @{
80+ Cert = $cert
81+ Type = "CERT"
82+ FilePath = "$home/tmp-cert.cer"
83+ NoClobber = $true
84+ }
85+ Export-Certificate @params
86+ certutil -encode $home/tmp-cert.cer $home/cosmosdbcert.cer
87+ Remove-Item $home/tmp-cert.cer
88+ $keystore = "-keystore", "${env:JAVA_HOME}/jre/lib/security/cacerts"
89+ & ${env:JAVA_HOME}/bin/keytool.exe $keystore -storepass 'changeit' -importcert -noprompt -alias cosmos_emulator -file $home/cosmosdbcert.cer
90+ & ${env:JAVA_HOME}/bin/keytool.exe $keystore -storepass 'changeit' -list -alias cosmos_emulator
91+
7792 - name : Setup Gradle
7893 uses : gradle/actions/setup-gradle@v4
7994
8095 - name : Build
8196 run : |
82- ./gradlew assemble
83- ./gradlew testJar
97+ ./gradlew.bat assemble
98+ ./gradlew.bat testJar
8499
85100 # due to a gradle bug we must run the integration test separately
86101 - name : Run integration tests
87102 working-directory : ledger
103+ # The heap size (-Xmx6g) and direct memory size (-XX:MaxDirectMemorySize=4g) were chosen
104+ # to handle high memory demands of the Cosmos DB emulator during integration tests,
105+ # ensuring stability and avoiding out-of-memory errors.
88106 run : |
89- java -Xmx6g -XX:MaxDirectMemorySize=4g \
90- -cp "build/test-libs/*:build/libs/*:build/classes/java/integrationTest" \
91- -Dscalardl.namespace_suffix="${{ steps.schema.outputs.namespace_suffix }}" \
92- -Dscalardb.storage=cosmos \
93- -Dscalardb.contact_points="${{ secrets.COSMOS_URI }}" \
94- -Dscalardb.password="${{ secrets.COSMOS_KEY }}" \
95- -Dscalardb.cosmos.ru=800 \
96- org.junit.platform.console.ConsoleLauncher execute -c=com.scalar.dl.ledger.service.LedgerServiceEndToEndTest
107+ java -Xmx6g -XX:MaxDirectMemorySize=4g `
108+ -cp "build/test-libs/*;build/libs/*;build/classes/java/integrationTest" `
109+ "-Dscalardb.storage=cosmos" `
110+ "-Dscalardb.contact_points=https://localhost:8081/" `
111+ "-Dscalardb.password=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==" `
112+ org.junit.platform.console.ConsoleLauncher execute "-c=com.scalar.dl.ledger.service.LedgerServiceEndToEndTest"
97113
98114 integration-test-with-dynamo :
99115 name : Integration testing with the Consensus Commit transaction manager on DynamoDB
0 commit comments