View Issue Details

IDProjectCategoryView StatusLast Update
0004516Talerbank (demonstrator)public2016-10-11 17:28
ReporterChristian GrothoffAssigned ToMarcello Stanisci 
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Platformi7OSDebian GNU/LinuxOS Versionsqueeze
Product Version0.0 
Target Version0.1Fixed in Version0.1 
Summary0004516: exchange 'test_bank_api' fails with latest taler bank
Description2016-05-21 12:42:13,093 settings INFO secret key not configured in TALER_BANK_SECRET_KEY env variable, generating random secret
2016-05-21 12:42:13,093 settings INFO using db 'talerbank'
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x8dca180 pid: 26993 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 26993)
spawned uWSGI worker 1 (pid: 27004, cores: 1)
spawned uWSGI http 1 (pid: 27005)
21/May/2016:12:42:13 +0000 HTTP/1.1 GET / HTTP/1.1 => 200

2016-05-21 12:42:13,381 funds INFO add_incoming for debit account 2 and credit accout 1
2016-05-21 12:42:13,406 funds ERROR currency KUDOS and currency PUDOS mismatch
Internal Server Error: /admin/add/incoming
Traceback (most recent call last):
  File "/home/grothoff/lib/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/grothoff/lib/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/grothoff/lib/python3.4/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/grothoff/lib/python3.4/site-packages/talerbank/app/funds.py", line 69, in add_incoming
    data['wtid'])
  File "/home/grothoff/lib/python3.4/site-packages/talerbank/app/funds.py", line 122, in wire_transfer_in_out
    credit_account.user.username + " (account #" + str(credit) + ")")
  File "/home/grothoff/lib/python3.4/site-packages/talerbank/app/funds.py", line 139, in wire_transfer
    raise errors.CurrencyMismatch()
NameError: name 'errors' is not defined
2016-05-21 12:42:13,407 base ERROR Internal Server Error: /admin/add/incoming
Traceback (most recent call last):
  File "/home/grothoff/lib/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/grothoff/lib/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/grothoff/lib/python3.4/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/grothoff/lib/python3.4/site-packages/talerbank/app/funds.py", line 69, in add_incoming
    data['wtid'])
  File "/home/grothoff/lib/python3.4/site-packages/talerbank/app/funds.py", line 122, in wire_transfer_in_out
    credit_account.user.username + " (account #" + str(credit) + ")")
  File "/home/grothoff/lib/python3.4/site-packages/talerbank/app/funds.py", line 139, in wire_transfer
    raise errors.CurrencyMismatch()
NameError: name 'errors' is not defined
21/May/2016:12:42:13 +0000 HTTP/1.1 POST /admin/add/incoming HTTP/1.1 => 500
May 21 14:42:13-494285 test-bank-api-26979 ERROR Assertion failed at test_bank_interpreter.c:159.
Unexpected response code 500:
SIGINT/SIGQUIT received...killing workers...
gateway "uWSGI http 1" has been buried (pid: 27005)
worker 1 buried after 1 seconds
goodbye to uWSGI.
FAIL test_bank_api (exit status: 1)
Steps To ReproduceJust run the test. I created a fresh DB.
Additional InformationLooks to me like a configuration option change causes a KUDOS/PUDOS missmatch in the testcase.
TagsNo tags attached.

Activities

Marcello Stanisci

2016-05-22 12:11

manager   ~0010698

should be fixed now, but I cannot launch the bank on my laptop right now. BTW, the error appears to be a wrong import:

    raise errors.CurrencyMismatch()
NameError: name 'errors' is not defined

Marcello Stanisci

2016-05-22 12:40

manager   ~0010699

and yes, even after this is fixed, there is the currency mismatch to fix

Marcello Stanisci

2016-05-22 14:32

manager   ~0010701

if the bank cannot find a

[taler]
currency = XY

in some .conf it defaults to KUDOS, therefore *creating* default accounts in KUDOS. So the error happened because the bank-lib testcase wanted to give PUDOS (hardocded in the testcase) to some KUDOS account.

In order to fix that

1 delete your tables (taler-bank-manage django flush)
2 edit ~/.config/taler.conf so that contains
[taler]
currency = PUDOS
3 launch testcase again (it should take care of creating default accounts automatically)

At least that helped out on my system.

Christian Grothoff

2016-05-24 20:46

manager   ~0010735

We clearly need to have a way for testcases to specify the use of a different "test" DB (and to cause a DB reset, similar to taler-exchange-dbinit -r). Otherwise, we'll continue to run into troubles with testcases not finding the environment the expect to run in, or worse, corrupting production DBs by accident.

Marcello Stanisci

2016-06-30 18:34

manager   ~0010951

https://docs.djangoproject.com/en/dev/topics/db/multi-db/

Marcello Stanisci

2016-07-01 14:33

manager   ~0010952

Fixed in 9c4e690..2b31910.

The bank's main script (taler-bank-manage) has now a '--with-db=dbx' option
which uses db 'dbx' and wipes it before using it.

Christian Grothoff

2016-07-01 14:41

manager   ~0010953

Please make sure the wiping is _optional_. The bank should certainly not wipe the database on every restart.

Marcello Stanisci

2016-07-01 14:47

manager   ~0010955

Ok, but the wiping only applies to this alternate db, which is meant to be used for testing. The default one gets wiped only manually.

Christian Grothoff

2016-07-01 14:50

manager   ~0010956

I'm not sure --with-db should be limited to only an 'alternate' DB, that is counter-intuitive. Just add a --reset-db option and only then do the reset.

Marcello Stanisci

2016-07-04 10:47

manager   ~0010960

I'd not add --reset-db because such a command is already provided by django.
So I suggest to just have a --with-db which does NOT wipe anything, and whenever
the user wants to wipe it, it goes like:

$ taler-bank-manage --with-db testdb django flush

If that's approved, we can close this.

Christian Grothoff

2016-07-04 12:44

manager   ~0010962

Sure, that's fine.

Marcello Stanisci

2016-07-04 13:18

manager   ~0010963

fixed in 67e7e35..59d5648

Summary:

# To use a non default db
$ taler-bank-manage --with-db ALT_DB cmds

# To wipe the non default db from a testcase (--noinput prevents you from being prompted for confirming)
$ taler-bank-manage --with-db ALT_DB django flush --noinput

Issue History

Date Modified Username Field Change
2016-05-21 14:45 Christian Grothoff New Issue
2016-05-21 14:45 Christian Grothoff Status new => assigned
2016-05-21 14:45 Christian Grothoff Assigned To => Marcello Stanisci
2016-05-22 12:11 Marcello Stanisci Note Added: 0010698
2016-05-22 12:40 Marcello Stanisci Note Added: 0010699
2016-05-22 14:32 Marcello Stanisci Note Added: 0010701
2016-05-24 20:46 Christian Grothoff Note Added: 0010735
2016-05-25 21:50 Christian Grothoff Target Version 0.0 => 0.1
2016-06-30 18:34 Marcello Stanisci Note Added: 0010951
2016-07-01 14:33 Marcello Stanisci Note Added: 0010952
2016-07-01 14:33 Marcello Stanisci Status assigned => resolved
2016-07-01 14:33 Marcello Stanisci Resolution open => fixed
2016-07-01 14:41 Christian Grothoff Note Added: 0010953
2016-07-01 14:41 Christian Grothoff Status resolved => feedback
2016-07-01 14:41 Christian Grothoff Resolution fixed => reopened
2016-07-01 14:47 Marcello Stanisci Note Added: 0010955
2016-07-01 14:50 Christian Grothoff Note Added: 0010956
2016-07-01 14:50 Christian Grothoff Status feedback => assigned
2016-07-04 10:47 Marcello Stanisci Note Added: 0010960
2016-07-04 12:44 Christian Grothoff Note Added: 0010962
2016-07-04 13:18 Marcello Stanisci Note Added: 0010963
2016-07-04 13:18 Marcello Stanisci Status assigned => resolved
2016-07-04 13:18 Marcello Stanisci Resolution reopened => fixed
2016-09-26 13:51 Christian Grothoff Fixed in Version => 0.1
2016-10-11 17:28 Christian Grothoff Status resolved => closed