chunhualiao / freeCompilerCamp

Goal: a website to automatically train and certify compiler researchers and developers
10 stars 1 forks source link

automatically test if the sandbox can show up #106

Open chunhualiao opened 4 years ago

chunhualiao commented 4 years ago

Right now we have to manually check if the sandbox can show up when a tutorial is openned.

Ideally, we should test this automatically and be the first to know if our sandbox has problems. There are some online site availability testing tools. If a site/URL is not available , they will send out email notifications.

Can you take a look if we can leverage them?

ouankou commented 4 years ago

The following command can be used to test a websocket connection in FreeCC. It connects the socket for 2s and disconnects automatically.

curl --include \
     --no-buffer \
     --max-time 2 \
     --header "Connection: Upgrade" \
     --header "Upgrade: websocket" \
     --header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
     --header "Sec-WebSocket-Version: 13" \
     http://lab.freecompilercamp.org:5010/sessions/bsqkfeoq4uig0s27i4q0/ws/

If a sandbox works, the following welcome message should be shown. fcc_success

Otherwise, it either shows nothing or other unexpected message. fcc_fail

By checking the output via grep, we can know whether the docker container works correctly.

We can either run a cron job to test FreeCC on our server periodically, or develop an app on some cloud service, such as Heroku, to monitor FreeCC.