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

Make 'TEST' the only proper mandatory test setting #1126

Merged
merged 1 commit into from
May 26, 2017

Conversation

okurz
Copy link
Member

@okurz okurz commented Jan 3, 2017

In before there was no real check for most settings implicitly allowing
undefined settings but causing perl warnings. This commit now properly
tests job results where no setting is set besides the name composed of
'TEST' itself. It is not pretty in all cases when the individual
string components are empty but it works.

Related progress issue: https://progress.opensuse.org/issues/6762

@coolo
Copy link
Contributor

coolo commented Jan 3, 2017

ok, I think I made clear enough that I consider this wrong. If you can't follow, let's get old over this one here.

@codecov-io
Copy link

codecov-io commented Jan 3, 2017

Codecov Report

Merging #1126 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1126      +/-   ##
==========================================
+ Coverage   87.01%   87.02%   +<.01%     
==========================================
  Files         101      101              
  Lines        7392     7396       +4     
==========================================
+ Hits         6432     6436       +4     
  Misses        960      960
Impacted Files Coverage Δ
lib/OpenQA/Schema/Result/Jobs.pm 94.46% <ø> (ø) ⬆️
lib/OpenQA/Schema.pm 100% <ø> (ø) ⬆️
lib/OpenQA/WebAPI/Controller/API/V1/Job.pm 83.26% <100%> (+0.14%) ⬆️
lib/OpenQA/Schema/ResultSet/Jobs.pm 95.87% <100%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c05c24...860baf1. Read the comment docs.

@okurz
Copy link
Member Author

okurz commented Jan 3, 2017

the settings are currently set as is_nullable in the schema which we can consider wrong for TEST but I am not sure. AFAICS there are three levels: UI, API, DB. For now it is breaking in UI when not set properly, API and DB are fine with undef/null. That is why I chose to handle it in UI in a safe way. If you think we can enforce it on the level of API even though the API never actually requires this to be set. We could go even further and waste space in the DB and make it mandatory there but neither API nor DB need the values so why care?

In short, I see the following options:

  1. handle it in UI accordingly where needed (as I did even though in a way that could be improved to prevent strings like '--.')
  2. handle it in API "job#create" to set a default value, i.e. empty strings,; write a script querying database for currently "undef" values and update jobs accordingly; ensure there are no other entry points to the job settings where this could be set wrong (e.g. over isos)
  3. make these values required in the schema with default to empty strings; database migration scripts to find all current undef values in the database and update to empty string
  4. keep it undefined, accept perl warnings and confuse users

I prefer 1, I can also follow 2 if you like.

@aaannz
Copy link
Contributor

aaannz commented Jan 3, 2017

For POST /api/v1/isos they are required. POST /api/v1/jobs doesn't require them, but IMO that's mistake.

@coolo
Copy link
Contributor

coolo commented Jan 3, 2017

3 is what I want, I can agree to 2.

@okurz okurz force-pushed the feature/no_mandatory_job_settings branch from 1c16f5d to d585c7d Compare January 12, 2017 11:41
@sysrich
Copy link
Member

sysrich commented Feb 28, 2017

Looks like a rebase needed

@okurz okurz force-pushed the feature/no_mandatory_job_settings branch from d585c7d to 20aab43 Compare April 26, 2017 15:40
@okurz
Copy link
Member Author

okurz commented Apr 26, 2017

updated to follow approach "3", i.e. initialize values in the database with an empty string except for TEST which is now mandatory (as in the previous commits in this PR).

open point: I wrote the upgrade script https://github.com/os-autoinst/openQA/pull/1126/files#diff-dd139f35469d0636667b588967ab0c64 with @Martchus but checking on a local database it is either not called or has no effect on migration. How can I ensure the script is called before the schema is upgraded and not after the try to migrate the database which would fail because there are entries which are not allowed anymore after the schema upgrade?

@coolo
Copy link
Contributor

coolo commented May 9, 2017

not calling 01 but a different number

@coolo
Copy link
Contributor

coolo commented May 9, 2017

I.e. if you want to run it before the DB migration, name it 01 and the sql 02

In before there was no real check for most settings implicitly allowing
undefined settings but causing perl warnings. This commit now properly
tests job results where no setting is set besides the name composed of
'TEST' itself. It is not pretty in all cases when the individual
string components are empty but it works.

This commit with the according database schema upgrade makes the values DISTRI
VERSION FLAVOR ARCH BUILD required in the schema with default to empty strings.
Also, there is a database migration script to find all current undef values in
the database and update to empty string.

The in-place job settings migration and transfer on update is updated
accordingly to avoid explicitly overwriting the values with undef in the
database which would null the entries which is not allowed anymore. Instead,
the database takes care to provide a valid empty string as value in the
according cases.

Not fully covered is:
* handle it in UI accordingly where needed e.g. to prevent strings like '--.'
* review the API entry points for additional checks for these settings and
harmonizing them

Related progress issue: https://progress.opensuse.org/issues/6762
@okurz okurz force-pushed the feature/no_mandatory_job_settings branch from 20aab43 to 860baf1 Compare May 22, 2017 16:24
@okurz
Copy link
Member Author

okurz commented May 22, 2017

updated:

  • database migration script now properly triggered before migration
  • tests fixed

I managed to still show warnings when showing some weirdly created tests locally but so far couldn't find the culprit. Anyway, a related fix would probably not require database changes and also tests should pass now already so IMHO ready to be merged although I would not mind if anyone else tests manually as well.

@coolo coolo merged commit bd86fec into os-autoinst:master May 26, 2017
@okurz okurz deleted the feature/no_mandatory_job_settings branch May 26, 2017 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants