Skip to content

Commit

Permalink
Update test script to extract run outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
msmygit committed Dec 15, 2023
1 parent 244448a commit 15878dd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
30 changes: 19 additions & 11 deletions SIT/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,18 @@ fi
. common.sh

_captureOutput() {
_info "Copying ${DOCKER_CDM}:/${testDir} into ${testDir}/output"
docker cp ${DOCKER_CDM}:/${testDir} ${testDir}/output
_info "Moving ${testDir}/output/*.out TO ${testDir}/output"
mv ${testDir}/output/*.out ${testDir}/output
_info "Moving ${testDir}/output/*.err TO ${testDir}/output"
mv ${testDir}/output/*.err ${testDir}/output
_info "Copying ${DOCKER_CDM}:/${testDir} into ${testDir}/output/"
docker cp ${DOCKER_CDM}:/${testDir} ${testDir}/output/
_info "Moving ${testDir}/output/$(basename ${testDir})/*.out TO ${testDir}/output/"
mv -v ${testDir}/output/$(basename ${testDir})/*.out ${testDir}/output/
_info "Moving ${testDir}/output/$(basename ${testDir})/*.err TO ${testDir}/output/"
mv -v ${testDir}/output/$(basename ${testDir})/*.err ${testDir}/output/
_info "Moving ${testDir}/output/$(basename ${testDir})/output/*.out TO ${testDir}/output/"
mv -v ${testDir}/output/$(basename ${testDir})/output/*.out ${testDir}/output/
_info "Moving ${testDir}/output/$(basename ${testDir})/output/*.err TO ${testDir}/output/"
mv -v ${testDir}/output/$(basename ${testDir})/output/*.err ${testDir}/output/
_info "Removing ${testDir}/output/$(basename ${testDir})"
rm -rf ${testDir}/output/$(basename ${testDir})
}

EXPECTED_FILES="setup.cql expected.cql expected.out execute.sh"
Expand Down Expand Up @@ -122,17 +128,17 @@ errors=0
for testDir in $(ls -d ${PHASE}/*); do
export testDir
_info ${testDir} Executing test
docker exec ${DOCKER_CDM} bash -e $testDir/execute.sh /$testDir > $testDir/output/execute.out 2>$testDir/output/execute.err
docker exec ${DOCKER_CDM} bash -e -c "$testDir/execute.sh /$testDir > $testDir/output/execute.out 2>$testDir/output/execute.err"
if [ $? -ne 0 ]; then
_error "${testDir}/execute.sh failed, see $testDir/output/execute.out and $testDir/output/execute.err"
echo "=-=-=-=-=-=-=-=-=-= Directory Listing =-=-=-=-=-=-=-=-=-=-"
echo "$(ls -laR ${testDir})"
echo "=-=-=-=-=-=-=- Container Directory Listing -=-=-=-=-=-=-=-"
echo "$(docker exec ${DOCKER_CDM} ls -laR ${testDir})"
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-==-=-=-=-=-=-=-=-=-=-=-=-"
_captureOutput
errors=1
fi
done
if [ $errors -ne 0 ]; then
_captureOutput
_fatal "One or more execute.sh failed. See above ERROR(s) for details."
fi

Expand All @@ -154,6 +160,7 @@ for testDir in $(ls -d ${PHASE}/*); do
fi
if [ $? -ne 0 ]; then
_error "${testDir}/expected.cql failed, see $testDir/output/actual.out $testDir/output/and actual.err"
_captureOutput
errors=1
continue
fi
Expand All @@ -162,18 +169,19 @@ for testDir in $(ls -d ${PHASE}/*); do
if [ $rtn -eq 1 ]; then
_error "${testDir} files differ (expected vs actual):"
sdiff -w 200 ${testDir}/expected.out ${testDir}/output/actual.out
_captureOutput
errors=1
continue
elif [ $rtn -ne 0 ]; then
_error "${testDir} had some other problem running diff"
_captureOutput
errors=1
continue
fi

_info "PASS: ${testDir} returned expected results"
done
if [ $errors -ne 0 ]; then
_captureOutput
_fatal "One or more expected results failed. See above ERROR(s) for details."
fi

Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/datastax/cdm/feature/WritetimeTTL.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public boolean initializeAndValidate(CqlTable originTable, CqlTable targetTable)
logger.error("Counter table cannot specify TTL or WriteTimestamp columns as they cannot set on write");
isValid = false;
isEnabled = false;
return false;
}

logger.info("Counter table does not support TTL or WriteTimestamp columns as they cannot set on write, so feature is disabled");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ public enum PropertyType {
required.add(ORIGIN_KEYSPACE_TABLE);
types.put(ORIGIN_TTL_NAMES, PropertyType.STRING_LIST);
types.put(ORIGIN_TTL_AUTO, PropertyType.BOOLEAN);
defaults.put(ORIGIN_TTL_AUTO, "false");
defaults.put(ORIGIN_TTL_AUTO, "true");
types.put(ORIGIN_WRITETIME_NAMES, PropertyType.STRING_LIST);
types.put(ORIGIN_WRITETIME_AUTO, PropertyType.BOOLEAN);
defaults.put(ORIGIN_WRITETIME_AUTO, "false");
defaults.put(ORIGIN_WRITETIME_AUTO, "true");
types.put(ORIGIN_COLUMN_NAMES_TO_TARGET, PropertyType.STRING_LIST);
}

Expand Down

0 comments on commit 15878dd

Please sign in to comment.