test should return error while necessary environ not fulfilled

Bug #955053 reported by TienFu Chen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox
Fix Released
Low
Daniel Manrique

Bug Description

If environs needed by a test are not set. The test should not be fired and return failure.

Version:
checkbox 0.13.4
checkbox-certification 0.13.1~ppa20.12.04

Report:
https://certification.canonical.com/hardware/201105-7956/submission/KNm2QMUVkyxl06e/results

From above report, you can see the tests are fired even the necessary environs are not set.
And some tested passed, some failed(by the command return status)

Alternative, we should check environ first, like: test $OPEN_BG_SSID && TEST_COMMAND

Related branches

TienFu Chen (ctf)
description: updated
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

I don't quite see the point of this - unless maybe you make it so that the job results clearly displays which values weren't set.

As for the tests passing put failing to create the connection, did you create a wireless connection manually before they ran?

Jeff Lane  (bladernr)
Changed in checkbox:
status: New → Incomplete
Revision history for this message
TienFu Chen (ctf) wrote :

Brendan,
I'm not sure if you agree the followings are different:
1) a test is not fulfilled to run
2) a test is not fulfilled to run, but is being run and result in failure(or accidentally success) .

The 2) is what this case is, if some factors(environ here) are not satisfied in a test, then I would say running it makes no sense.

And as an user of checkbox, I have all kind of reason not setting the right configurations before running checkbox(in this case, wireless configurations in the /etc/profile), because I'm an user, a human, I can mess up any configurations easily. So we need the program to check those for us.

Let look at the test result below:
wireless/wireless_connection_open_n certification Pass Must specify an SSID to connect to. Internet connection fully established
The status is "Pass" which is not actually, is what "accidentally success" I'm talking about. If we have picked up the environ error early, then we don't need to worry about it.

Also the test command below:
trap "rm -f /etc/NetworkManager/system-connections/$OPEN_N_SSID" EXIT; ./create_connection $OPEN_N_SSID; ./internet_test --interface=`nmcli dev status | awk '/802-11-wireless/ {print $1}'`

I would suggest to use "nmcli con status" instead of "nmcli dev status".
"nmcli con status" has output like below:
DEVICE TYPE STATE
wlan0 802-11-wireless disconnected
eth0 802-3-ethernet unmanaged

The above information don't provide which AP the system is connected to.

Whereas "nmcli con status" has below output:
NAME UUID DEVICES DEFAULT VPN MASTER-PATH
ubuntu-cert-n-open e8ddb87c-0685-4f72-a476-6c846eafa73b wlan0 yes no --

We can compare the NAME to make sure the AP is what we want to connect to.

Also it might be good to concatenate each sub-command with "&&" to catch the error early.

-------------------
Now get back to your question:
did I create a wireless connection manually before they ran?
I really don't remember if I have done that or not, but it seems like I did, according to the result from "internet_test".
So we may disconnect any present wireless connection first and continue the test.

TienFu Chen (ctf)
Changed in checkbox:
status: Incomplete → Confirmed
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Unless we update each test to explicitly check the environment variables, there's no universal way of addressing this. I still don't see it as a big problem though, so I've assigned it an importance of Low

Changed in checkbox:
importance: Undecided → Low
Revision history for this message
Daniel Manrique (roadmr) wrote :

Rather than doing this check at runtime, I added a simple test that validates that all jobs that have a user also use environ for all the variables referenced in the command.

This still leaves us uncovered in two cases:

1- A variable is referenced in a script rather than in the job file. This is bad practice as hardcoding environment variable names in scripts is too opaque.

2- User-written jobs. Since the tests work only on the jobs we ship with checkbox, anything outside that will not be tested.

Still, this will prevent us from shipping broken jobs in checkbox itself which I think is an improvement anyway.

Changed in checkbox:
status: Confirmed → In Progress
assignee: nobody → Daniel Manrique (roadmr)
Marc Tardif (cr3)
Changed in checkbox:
status: In Progress → Fix Committed
Changed in checkbox:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.