mirror of https://github.com/zulip/zulip.git
39 lines
1.5 KiB
Bash
Executable File
39 lines
1.5 KiB
Bash
Executable File
#!/bin/bash -e
|
|
|
|
function migration_status {
|
|
./manage.py migrate --list | sed 's/*/ /' > "$1"
|
|
}
|
|
|
|
if [ -e zephyr/tests/zephyrdb.test.pristine ]; then
|
|
migration_status zephyr/fixtures/available-migrations
|
|
if [ -e zephyr/fixtures/migration-status ] &&
|
|
cmp -s zephyr/fixtures/available-migrations zephyr/fixtures/migration-status &&
|
|
[ "$1" != "--force" ]; then
|
|
cp zephyr/tests/zephyrdb.test.pristine zephyr/tests/zephyrdb.test
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
mkdir -p zephyr/fixtures
|
|
rm -f zephyr/tests/zephyrdb.test
|
|
rm -f zephyr/tests/zephyrdb.test.pristine
|
|
|
|
# Remove time.pyc to try to prevent it from screwing people importing
|
|
# time from inside zephyr.lib. We can drop this hack after a bit.
|
|
rm -f zephyr/lib/time.pyc
|
|
|
|
python manage.py syncdb --noinput --settings=humbug.test_settings
|
|
python manage.py migrate --settings=humbug.test_settings --all
|
|
migration_status "zephyr/fixtures/migration-status"
|
|
|
|
# This next line can be simplified to "-n0" once we fix our app with 0 messages.
|
|
python manage.py populate_db --settings=humbug.test_settings --test-suite -n2 \
|
|
--threads=1 --huddles=0 --personals=0 --percent-huddles=0 --percent-personals=0
|
|
python manage.py dumpdata --settings=humbug.test_settings \
|
|
zephyr.UserProfile zephyr.Stream zephyr.Recipient \
|
|
zephyr.Subscription zephyr.Message zephyr.Huddle zephyr.Realm \
|
|
zephyr.UserMessage zephyr.Client \
|
|
zephyr.DefaultStream > zephyr/fixtures/messages.json
|
|
|
|
cp zephyr/tests/zephyrdb.test zephyr/tests/zephyrdb.test.pristine
|