Skip to content

Commit

Permalink
don't check timestamp twice
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Brahmer <[email protected]>
  • Loading branch information
Grotax committed Jan 2, 2025
1 parent 766a665 commit 62a5a10
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions tests/updater/update.bats
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,8 @@ teardown() {

UpdateTime2=$(http --ignore-stdin -b -a ${user}:${APP_PASSWORD} GET ${BASE_URLv1}/feeds | jq '.feeds | .[0].nextUpdateTime')

# Check if UpdateTime2 is within the expected range and print it if not
if [[ $UpdateTime2 -lt $expected_time_min || $UpdateTime2 -gt $expected_time_max ]]; then
echo "UpdateTime2 is out of range: $UpdateTime2"
fi

# Assert that UpdateTime2 is within the expected range
run bash -c "[[ $UpdateTime2 -ge $expected_time_min && $UpdateTime2 -le $expected_time_max ]]"
# Assert that UpdateTime2 is within the expected range and print the timestamp if not
run bash -c "[[ \$UpdateTime2 -ge \$expected_time_min && \$UpdateTime2 -le \$expected_time_max ]] || echo \"UpdateTime2 is out of range: \$UpdateTime2\""
assert_success

}
Expand Down Expand Up @@ -128,34 +123,6 @@ teardown() {
assert_output --partial "${ID_LIST1[*]}"
}

# older date is not a thing anymore
#@test "[$TESTSUITE] Test feed with 'outdated' items https://github.com/nextcloud/news/issues/2236 " {
# # Create Feed, for the first fetch a timestamp today -1 year is used.
# FEEDID=$(http --ignore-stdin -b -a ${user}:${APP_PASSWORD} POST ${BASE_URLv1}/feeds url=$TEST_FEED | grep -Po '"id":\K([0-9]+)')
#
# sleep 2
#
# # Get Items
# ID_LIST1=($(http --ignore-stdin -b -a ${user}:${APP_PASSWORD} GET ${BASE_URLv1}/items | grep -Po '"id":\K([0-9]+)' | tr '\n' ' '))
#
# # Generate Feed with older items (-o yes)
# php ${BATS_TEST_DIRNAME}/../test_helper/php-feed-generator/feed-generator.php -a 15 -s 9 -f ${BATS_TEST_DIRNAME}/../test_helper/feeds/test.xml -o yes
#
# # Trigger Update
# http --ignore-stdin -b -a ${user}:${APP_PASSWORD} GET ${BASE_URLv1}/feeds/update userId=${user} feedId=$FEEDID
#
# sleep 2
#
# # Get Items again
# ID_LIST2=($(http --ignore-stdin -b -a ${user}:${APP_PASSWORD} GET ${BASE_URLv1}/items | grep -Po '"id":\K([0-9]+)' | tr '\n' ' '))
#
# output="${ID_LIST2[*]}"
#
# # Check that they are not equal but that they match partially.
# assert_not_equal "${ID_LIST1[*]}" "${ID_LIST2[*]}"
# assert_output --partial "${ID_LIST1[*]}"
#}

@test "[$TESTSUITE] Test purge with small feed" {
# Disable useNextUpdateTime
./occ config:app:set news useNextUpdateTime --value=false
Expand Down

0 comments on commit 62a5a10

Please sign in to comment.