We forgot to include 'task_output/', which is a directory into which we
copy all task-generated task artifacts.
Example error here: http://taskotron-dev.fedoraproject.org/resultsdb/results/1648831
(Click on Log, then fix the URL)
We forgot to include 'task_output/', which is a directory into which we
copy all task-generated task artifacts.
Example error here: http://taskotron-dev.fedoraproject.org/resultsdb/results/1648831
(Click on Log, then fix the URL)
hard to test, but it s-word work
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | libtaskotron/directives/resultsdb_directive.py (5 lines) | |||
| M | testing/test_resultsdb_directive.py (2 lines) |
| Commit | Tree | Parents | Author | Summary | Date |
|---|---|---|---|---|---|
| 97d6e5b4c8d1 | 6a4af4db1c4d | 4983042c6606 | Kamil Páral | fix unit tests | Jul 15 2015, 3:47 PM |
| 4983042c6606 | 57862a33469b | 0bf7b5230b0b | Kamil Páral | resultsdb_directive: fix artifact URL (Show More…) | Jul 15 2015, 1:40 PM |
| Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Line(s) | 161 | def get_artifact_path(self, artifactsdir, artifact): | |||
|---|---|---|---|---|---|
| 170 | else: | 170 | else: | ||
| 171 | artifact_path = os.path.join(artifactsdir, artifact) | 171 | artifact_path = os.path.join(artifactsdir, artifact) | ||
| 172 | artifact_path = os.path.realpath(artifact_path) | 172 | artifact_path = os.path.realpath(artifact_path) | ||
| 173 | 173 | | |||
| 174 | if not os.path.exists(artifact_path): | 174 | if not os.path.exists(artifact_path): | ||
| 175 | log.warn('Artifact %r does not exist, ignoring' % artifact_path) | 175 | log.warn('Artifact %r does not exist, ignoring' % artifact_path) | ||
| 176 | return None | 176 | return None | ||
| 177 | elif not artifact_path.startswith(artifactsdir): | 177 | elif not artifact_path.startswith(artifactsdir): | ||
| 178 | log.warn('Artifact %r is placed outside of artifacts directory %r, ignoring' % (artifact_path, artifactsdir)) | 178 | log.warn('Artifact %r is placed outside of artifacts directory %r, ignoring', | ||
| 179 | artifact_path, artifactsdir) | ||||
| 179 | return None | 180 | return None | ||
| 180 | 181 | | |||
| 181 | return os.path.relpath(artifact_path, start=artifactsdir) | 182 | return os.path.relpath(artifact_path, start=artifactsdir) | ||
| 182 | 183 | | |||
| 183 | def process(self, input_data, env_data): | 184 | def process(self, input_data, env_data): | ||
| 184 | #TODO: Replace with proper location and adjust exc. text | 185 | #TODO: Replace with proper location and adjust exc. text | ||
| 185 | # we're creating the jobid in the directive for now, so adjust the check | 186 | # we're creating the jobid in the directive for now, so adjust the check | ||
| 186 | 187 | | |||
| Show All 38 Lines | 224 | for detail in check_details: | |||
| 225 | self.ensure_testcase_exists(checkname) | 226 | self.ensure_testcase_exists(checkname) | ||
| 226 | result_log_url = log_url | 227 | result_log_url = log_url | ||
| 227 | if detail.artifact: | 228 | if detail.artifact: | ||
| 228 | artifact_path = self.get_artifact_path( | 229 | artifact_path = self.get_artifact_path( | ||
| 229 | env_data['artifactsdir'], | 230 | env_data['artifactsdir'], | ||
| 230 | detail.artifact | 231 | detail.artifact | ||
| 231 | ) | 232 | ) | ||
| 232 | if artifact_path: | 233 | if artifact_path: | ||
| 233 | result_log_url = "%s/all/%s/%s" % ( | 234 | result_log_url = "%s/all/%s/task_output/%s" % ( | ||
| 234 | self.artifacts_baseurl, | 235 | self.artifacts_baseurl, | ||
| 235 | env_data['uuid'], | 236 | env_data['uuid'], | ||
| 236 | artifact_path, | 237 | artifact_path, | ||
| 237 | ) | 238 | ) | ||
| 238 | try: | 239 | try: | ||
| 239 | result = self.resultsdb.create_result( | 240 | result = self.resultsdb.create_result( | ||
| 240 | job_id = job_data['id'], | 241 | job_id = job_data['id'], | ||
| 241 | testcase_name = checkname, | 242 | testcase_name = checkname, | ||
| ▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines | |||||
| Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Line(s) | 197 | def test_report_artifact_in_log_url(self, monkeypatch): | |||
|---|---|---|---|---|---|
| 226 | # This could be written as self.stub_rdb.calls()[0] at the moment, but | 226 | # This could be written as self.stub_rdb.calls()[0] at the moment, but | ||
| 227 | # this is more future-proof, and accidental addition of resultsdb | 227 | # this is more future-proof, and accidental addition of resultsdb | ||
| 228 | # calls is handled by the previous assert. | 228 | # calls is handled by the previous assert. | ||
| 229 | call = [call for call in self.stub_rdb.calls() if call[0] == 'create_result'][0] | 229 | call = [call for call in self.stub_rdb.calls() if call[0] == 'create_result'][0] | ||
| 230 | # Select the keyword arguments of that call | 230 | # Select the keyword arguments of that call | ||
| 231 | call_data = call[2] | 231 | call_data = call[2] | ||
| 232 | 232 | | |||
| 233 | # the log url depends on the env_data, so construct it here | 233 | # the log url depends on the env_data, so construct it here | ||
| 234 | ref_log_url = '%s/all/%s/%s' %\ | 234 | ref_log_url = '%s/all/%s/task_output/%s' %\ | ||
| 235 | (self.conf.artifacts_baseurl, self.ref_envdata['uuid'], cd.artifact) | 235 | (self.conf.artifacts_baseurl, self.ref_envdata['uuid'], cd.artifact) | ||
| 236 | 236 | | |||
| 237 | assert call_data['log_url'] == ref_log_url | 237 | assert call_data['log_url'] == ref_log_url | ||
| 238 | 238 | | |||
| 239 | def test_create_job(self): | 239 | def test_create_job(self): | ||
| 240 | # make sure that the proper API calls are made to create a resultsdb job | 240 | # make sure that the proper API calls are made to create a resultsdb job | ||
| 241 | test_jobdata = self.test_rdb.create_resultsdb_job(self.ref_envdata['checkname'], | 241 | test_jobdata = self.test_rdb.create_resultsdb_job(self.ref_envdata['checkname'], | ||
| 242 | self.ref_refurl) | 242 | self.ref_refurl) | ||
| ▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines | |||||