Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix E2E flaky tests #708

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ curl -s -X PUT "elasticsearch:9200/_cluster/settings" -H 'Content-Type: applicat
}
}'

echo ""
echo "Removed disk space watermark in ElasticSearch."
23 changes: 22 additions & 1 deletion support-services/docker-entrypoint.d/10-index-records.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ password=admin
xsrf_token=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
host=geonetwork:8080

echo "Logging in to GeoNetwork..."

# first login to get an authenticated admin session
jsessionid=$(
curl -s "http://$host/geonetwork/signin" \
Expand All @@ -14,6 +16,8 @@ jsessionid=$(
-c - | grep JSESSIONID | awk '{ print $7 }'
)

echo "Triggering full records indexation in GeoNetwork..."

# then trigger an indexing
result=$(
curl -s "http://$host/geonetwork/srv/api/site/index" \
Expand All @@ -39,8 +43,25 @@ do
-H "Cookie: JSESSIONID=$jsessionid; XSRF-TOKEN=$xsrf_token" \
-H "X-XSRF-TOKEN: $xsrf_token"
)
echo "Indexing? $indexing"
echo "Currently indexing: $indexing"
sleep 1
done

# finally check that the index has records in it
recordsCount=0
while [ "$recordsCount" = '0' ];
do
response=$(
curl -s "http://$host/geonetwork/srv/api/search/records/_search" \
-H 'Accept: application/json, text/plain, */*' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H "Cookie: JSESSIONID=$jsessionid; XSRF-TOKEN=$xsrf_token" \
-H "X-XSRF-TOKEN: $xsrf_token" \
--data-raw '{"size":0}'
)
recordsCount=$(echo $response | sed 's/.*"hits":{"total":{"value":\([0-9]\+\).*/\1/g')
echo "Records found: $recordsCount"
sleep 2
done

echo "Indexing job in GeoNetwork successful."
Loading