Clean tmpdirs in metrics endpoint specs
requested to merge 33401-follow-up-from-add-prometheus-metrics-endpoint-and-basic-infrastructure-to-meter-code into master
What does this MR do?
This MR tweaks the metrics controller specs to cleanup created temporary directories by using Dir.mktmpdir
in around
.
Before
Running rspec spec/controllers/metrics_controller_spec.rb
left some stray directories in /tmp
:
$ rspec spec/controllers/metrics_controller_spec.rb
...
$ ls -ald /tmp/d*
drwx------ 2 peter peter 4096 Aug 6 15:48 /tmp/d20190806-16684-16gyehr
drwx------ 2 peter peter 4096 Aug 6 15:48 /tmp/d20190806-16684-176a0zk
drwx------ 2 peter peter 4096 Aug 6 15:48 /tmp/d20190806-16684-18ccy09
drwx------ 2 peter peter 4096 Aug 6 15:48 /tmp/d20190806-16684-1vxa1dq
drwx------ 2 peter peter 4096 Aug 6 15:48 /tmp/d20190806-16684-p0fs7b
After
$ rspec spec/controllers/metrics_controller_spec.rb
...
$ ls -ald /tmp/d*
ls: cannot access '/tmp/d*': No such file or directory
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry for user-facing changes, or community contribution. Check the link for other scenarios. -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Closes #33401 (closed)
Edited by 🤖 GitLab Bot 🤖