Skip to content

Commit

Permalink
Merge pull request #5259 from dsplayerX/fix_4625
Browse files Browse the repository at this point in the history
Fix standard library integration tests not executing properly
  • Loading branch information
keizer619 authored Mar 21, 2024
2 parents 2fbda9c + 8973f29 commit 440fbd1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 7 additions & 7 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ task testExamples() {
}
}

def buildStandardLibs = { distPath, stdlibTest, isStageTest, testMinorVersionDifference ->
def buildAndTestStandardLibs = { distPath, stdlibTest, isStageTest, testMinorVersionDifference ->
def exitVal
def additionalBuildParams = ""

Expand All @@ -1099,12 +1099,12 @@ def buildStandardLibs = { distPath, stdlibTest, isStageTest, testMinorVersionDif
if (!isStageTest) {
exec {
workingDir "${distPath}/${stdlibTest}"
commandLine 'cmd', '/c', "${distPath}/bin/bal/bal.bat init test"
commandLine 'cmd', '/c', "${distPath}/bin/bal.bat init test"
}
} else {
exec {
workingDir "${distPath}/${stdlibTest}"
commandLine 'cmd', '/c', "${distPath}/bin/bal/bal.bat clean"
commandLine 'cmd', '/c', "${distPath}/bin/bal.bat clean"
}
}
if (testMinorVersionDifference) {
Expand All @@ -1116,7 +1116,7 @@ def buildStandardLibs = { distPath, stdlibTest, isStageTest, testMinorVersionDif
exitVal = exec {
ignoreExitValue true
workingDir "${distPath}/${stdlibTest}"
commandLine 'cmd', '/c', "${distPath}/bin/bal.bat build ${additionalBuildParams}"
commandLine 'cmd', '/c', "${distPath}/bin/bal.bat test ${additionalBuildParams}"
}
} else {
if (!isStageTest) {
Expand All @@ -1140,7 +1140,7 @@ def buildStandardLibs = { distPath, stdlibTest, isStageTest, testMinorVersionDif
environment "BALLERINA_STAGE_CENTRAL", "$isStageTest"
ignoreExitValue true
workingDir "${distPath}/${stdlibTest}"
commandLine 'sh', '-c', "${distPath}/bin/bal build ${additionalBuildParams}"
commandLine 'sh', '-c', "${distPath}/bin/bal test ${additionalBuildParams}"
}
}
if (exitVal.getExitValue() == 1) {
Expand Down Expand Up @@ -1181,7 +1181,7 @@ task testStdlibs() {
def failedStdLibs = []
stdlibTestsList.each { stdlibTest ->
if (stdlibTest.enableTest) {
boolean stdLibTestFailFlag = buildStandardLibs(distPath, stdlibTest.path, false, false)
boolean stdLibTestFailFlag = buildAndTestStandardLibs(distPath, stdlibTest.path, false, false)
if (stdLibTestFailFlag) {
failedStdLibs.add(stdlibTest.path);
}
Expand Down Expand Up @@ -1222,7 +1222,7 @@ task testStdlibsWithStaging() {
def failedStdLibs = []
stdlibTestsList.each { stdlibTest ->
if (stdlibTest.enableTest) {
boolean stdLibTestFailFlag = buildStandardLibs(distPath, stdlibTest.path, true, testMinorVersionDifference)
boolean stdLibTestFailFlag = buildAndTestStandardLibs(distPath, stdlibTest.path, true, testMinorVersionDifference)
if (stdLibTestFailFlag) {
failedStdLibs.add(stdlibTest.path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ service /hello on restIntrospectionEP {
http:Client restApiClient = checkpanic new("http://localhost:9118");

//Test Introspection Resource availability
@test:Config {}
@test:Config {
enable: false
}
function testIntrospectionResourceAvailability() returns error? {
http:Response response = check restApiClient->options("/hello");
test:assertEquals(response.statusCode, 204);
Expand Down Expand Up @@ -81,7 +83,9 @@ json openApiDocumentation = {
};

//Test REST API Doc
@test:Config {}
@test:Config {
enable: false
}
function testRestApiDoc() returns error? {
json receivedApiDoc = check restApiClient->get("/hello/openapi-doc-dygixywsw");
test:assertEquals(receivedApiDoc, openApiDocumentation);
Expand Down

0 comments on commit 440fbd1

Please sign in to comment.