mirror of
https://framagit.org/fiat-tux/hat-softwares/lutim.git
synced 2026-06-21 10:35:26 +02:00
Merge branch 'improve-tests' into 'development'
Improve tests See merge request fiat-tux/hat-softwares/lutim!76
This commit is contained in:
+26
-51
@@ -21,6 +21,7 @@ variables:
|
||||
retry: 2
|
||||
except:
|
||||
- tags
|
||||
|
||||
.carton_bdd_template: &carton_bdd_definition
|
||||
<<: *retry
|
||||
stage: carton_bdd
|
||||
@@ -29,20 +30,29 @@ variables:
|
||||
- local/
|
||||
needs:
|
||||
- carton
|
||||
.sqlite_template: &sqlite_definition
|
||||
|
||||
.test_template: &test_definition
|
||||
<<: *retry
|
||||
stage: tests
|
||||
script:
|
||||
- MOJO_CONFIG=t/$CI_JOB_NAME.conf make test
|
||||
- MOJO_CONFIG=t/$CI_JOB_NAME.conf make watch
|
||||
- MOJO_CONFIG=t/$CI_JOB_NAME.conf make cleanbdd
|
||||
- MOJO_CONFIG=t/$CI_JOB_NAME.conf make cleanfiles
|
||||
- MOJO_CONFIG=t/$CI_JOB_NAME.conf make stats
|
||||
- MOJO_CONFIG=t/$CI_JOB_NAME.conf make test-junit-output
|
||||
artifacts:
|
||||
paths:
|
||||
- tap.xml
|
||||
- cover_db/
|
||||
|
||||
.sqlite_template: &sqlite_definition
|
||||
<<: *test_definition
|
||||
needs:
|
||||
- carton_sqlite
|
||||
|
||||
.pg_template: &pg_definition
|
||||
<<: *retry
|
||||
stage: tests
|
||||
artifacts:
|
||||
paths:
|
||||
- cover_db/
|
||||
<<: *test_definition
|
||||
needs:
|
||||
- carton_postgresql
|
||||
services:
|
||||
@@ -96,75 +106,37 @@ carton_postgresql:
|
||||
#
|
||||
sqlite1:
|
||||
<<: *sqlite_definition
|
||||
script:
|
||||
before_script:
|
||||
- carton install --deployment --without=postgresql --without=minion --without=cache --without=memcached
|
||||
- MOJO_CONFIG=t/sqlite1.conf make test-sqlite
|
||||
- MOJO_CONFIG=t/sqlite1.conf make watch
|
||||
- MOJO_CONFIG=t/sqlite1.conf make cleanbdd
|
||||
- MOJO_CONFIG=t/sqlite1.conf make cleanfiles
|
||||
- MOJO_CONFIG=t/sqlite1.conf make stats
|
||||
sqlite2:
|
||||
<<: *sqlite_definition
|
||||
script:
|
||||
before_script:
|
||||
- carton install --deployment --without=postgresql --without=cache --without=memcached
|
||||
- MOJO_CONFIG=t/sqlite2.conf make minion &
|
||||
- sleep 3
|
||||
- MOJO_CONFIG=t/sqlite2.conf make test-sqlite
|
||||
- MOJO_CONFIG=t/sqlite2.conf make watch
|
||||
- MOJO_CONFIG=t/sqlite2.conf make cleanbdd
|
||||
- MOJO_CONFIG=t/sqlite2.conf make cleanfiles
|
||||
- MOJO_CONFIG=t/sqlite2.conf make stats
|
||||
sqlite3:
|
||||
<<: *sqlite_definition
|
||||
services:
|
||||
- name: postgres:9.6
|
||||
alias: postgres
|
||||
script:
|
||||
before_script:
|
||||
- carton install --deployment --without=cache --without=memcached
|
||||
- export PGPASSWORD=lutim_pwd; echo 'CREATE DATABASE lutim_minion WITH OWNER lutim;' | psql -h postgres -U lutim lutim_db
|
||||
- MOJO_CONFIG=t/sqlite3.conf make minion &
|
||||
- sleep 3
|
||||
- MOJO_CONFIG=t/sqlite3.conf make test-sqlite
|
||||
- MOJO_CONFIG=t/sqlite3.conf make watch
|
||||
- MOJO_CONFIG=t/sqlite3.conf make cleanbdd
|
||||
- MOJO_CONFIG=t/sqlite3.conf make cleanfiles
|
||||
- MOJO_CONFIG=t/sqlite3.conf make stats
|
||||
|
||||
### PostgreSQL tests
|
||||
##
|
||||
#
|
||||
postgresql1:
|
||||
<<: *pg_definition
|
||||
script:
|
||||
before_script:
|
||||
- carton install --deployment --without=sqlite --without=minion --without=cache --without=memcached
|
||||
- MOJO_CONFIG=t/postgresql1.conf make test-pg
|
||||
- MOJO_CONFIG=t/postgresql1.conf make watch
|
||||
- MOJO_CONFIG=t/postgresql1.conf make cleanbdd
|
||||
- MOJO_CONFIG=t/postgresql1.conf make cleanfiles
|
||||
- MOJO_CONFIG=t/postgresql1.conf make stats
|
||||
postgresql2:
|
||||
<<: *pg_definition
|
||||
script:
|
||||
before_script:
|
||||
- carton install --deployment --without=cache --without=memcached
|
||||
- MOJO_CONFIG=t/postgresql2.conf make minion &
|
||||
- sleep 3
|
||||
- MOJO_CONFIG=t/postgresql2.conf make test-pg
|
||||
- MOJO_CONFIG=t/postgresql2.conf make watch
|
||||
- MOJO_CONFIG=t/postgresql2.conf make cleanbdd
|
||||
- MOJO_CONFIG=t/postgresql2.conf make cleanfiles
|
||||
- MOJO_CONFIG=t/postgresql2.conf make stats
|
||||
postgresql3:
|
||||
<<: *pg_definition
|
||||
script:
|
||||
before_script:
|
||||
- carton install --deployment --without=sqlite --without=cache --without=memcached
|
||||
- export PGPASSWORD=lutim_pwd; echo 'CREATE DATABASE lutim_minion WITH OWNER lutim;' | psql -h postgres -U lutim lutim_db
|
||||
- MOJO_CONFIG=t/postgresql3.conf make minion &
|
||||
- sleep 3
|
||||
- MOJO_CONFIG=t/postgresql3.conf make test-pg
|
||||
- MOJO_CONFIG=t/postgresql3.conf make watch
|
||||
- MOJO_CONFIG=t/postgresql3.conf make cleanbdd
|
||||
- MOJO_CONFIG=t/postgresql3.conf make cleanfiles
|
||||
- MOJO_CONFIG=t/postgresql3.conf make stats
|
||||
|
||||
### Code coverage
|
||||
##
|
||||
@@ -173,6 +145,9 @@ cover:
|
||||
stage: cover
|
||||
script:
|
||||
- make cover
|
||||
coverage: '/Total .*\d+\.\d+$/'
|
||||
coverage: '/Total.* (\d+\.\d+)$/'
|
||||
artifacts:
|
||||
reports:
|
||||
junit: tap.xml
|
||||
except:
|
||||
- tags
|
||||
|
||||
@@ -5,6 +5,7 @@ XGETTEXT=carton exec local/bin/xgettext.pl -u
|
||||
CARTON=carton exec
|
||||
LUTIM=script/lutim
|
||||
REAL_LUTIM=script/application
|
||||
HARNESS_PERL_SWITCHES=-MDevel::Cover=+ignore,local
|
||||
HEAD := $(shell git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
minify:
|
||||
@@ -24,16 +25,20 @@ stats-locales:
|
||||
podcheck:
|
||||
podchecker lib/Lutim/DB/Image.pm
|
||||
|
||||
check-syntax:
|
||||
find lib/ themes/ -name \*.pm -exec $(CARTON) perl -Ilib -c {} \;
|
||||
find t/ -name \*.t -exec $(CARTON) perl -Ilib -c {} \;
|
||||
|
||||
cover:
|
||||
PERL5OPT='-Ilib/' HARNESS_PERL_SWITCHES='-MDevel::Cover' $(CARTON) cover --ignore_re '^local'
|
||||
PERL5OPT='-Ilib' $(CARTON) cover --ignore_re '^local'
|
||||
|
||||
test-sqlite:
|
||||
@PERL5OPT='-Ilib/' HARNESS_PERL_SWITCHES='-MDevel::Cover' $(CARTON) $(REAL_LUTIM) test
|
||||
test:
|
||||
@PERL5OPT='-Ilib/' HARNESS_PERL_SWITCHES='$(HARNESS_PERL_SWITCHES)' $(CARTON) -- prove -l --failures
|
||||
|
||||
test-pg:
|
||||
@PERL5OPT='-Ilib/' HARNESS_PERL_SWITCHES='-MDevel::Cover' $(CARTON) $(REAL_LUTIM) test
|
||||
test-junit-output:
|
||||
@PERL5OPT='-Ilib/' HARNESS_PERL_SWITCHES='$(HARNESS_PERL_SWITCHES)' $(CARTON) -- prove -l --failures --formatter TAP::Formatter::JUnit > tap.xml
|
||||
|
||||
test: podcheck test-sqlite test-pg
|
||||
full-test: podcheck just-test
|
||||
|
||||
clean:
|
||||
rm -rf lutim.db files/
|
||||
|
||||
@@ -150,8 +150,7 @@ $t->get_ok('/d/'.$rshort.'/'.$token, form => { format => 'json' })
|
||||
$t->get_ok('/'.$rshort)
|
||||
->status_is(302);
|
||||
|
||||
# Needed if we use Minion with sqlite for increasing counters
|
||||
sleep 8;
|
||||
$t->app->minion->perform_jobs if $t->app->config('minion')->{enabled};
|
||||
|
||||
# Get image counter
|
||||
$t->post_ok('/c', form => { short => $rshort, token => $token })
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
Usage: APPLICATION COMMAND [OPTIONS]
|
||||
|
||||
mojo version
|
||||
mojo generate lite_app
|
||||
./myapp.pl daemon -m production -l http://*:8080
|
||||
./myapp.pl get /foo
|
||||
./myapp.pl routes -v
|
||||
|
||||
Tip: CGI and PSGI environments can be automatically detected very often and
|
||||
work without commands.
|
||||
|
||||
Options (for all commands):
|
||||
-h, --help Get more information on a specific command
|
||||
--home <path> Path to home directory of your application, defaults to
|
||||
the value of MOJO_HOME or auto-detection
|
||||
-m, --mode <name> Operating mode for your application, defaults to the
|
||||
value of MOJO_MODE/PLACK_ENV or "development"
|
||||
|
||||
Commands:
|
||||
cgi Start application with CGI
|
||||
cpanify Upload distribution to CPAN
|
||||
cron Execute tasks.
|
||||
daemon Start application with HTTP and WebSocket server
|
||||
eval Run code against application
|
||||
generate Generate files and directories from templates
|
||||
get Perform HTTP request
|
||||
image Manage stored images
|
||||
inflate Inflate embedded files to real files
|
||||
prefork Start application with pre-forking HTTP and WebSocket server
|
||||
psgi Start application with PSGI
|
||||
routes Show available routes
|
||||
test Run tests
|
||||
theme Create new theme skeleton.
|
||||
version Show versions of available modules
|
||||
|
||||
See 'APPLICATION help COMMAND' for more information on a specific command.
|
||||
Reference in New Issue
Block a user