Comments (5)
Sounds also like a good idea for yet another tmt * lint
check, one that looks not just at a single object at a time, but also keeps some notion of the global state, i.e. the existing IDs that were previously detected in the set of objects already examined.
from tmt.
I agree, I think it would fit good as another lint check.
And yes, if I understand it correctly (but only had a brief look at it), I'd need to introduce state into the tmt test id
command (keeping track of the IDs). Is this acceptable or should this just be a lint check? It would be convenient to auto-fix duplicate IDs, though. Is there a tmt * lint --auto-fix
or something similar? @happz
from tmt.
I agree, I think it would fit good as another lint check. And yes, if I understand it correctly (but only had a brief look at it), I'd need to introduce state into the
tmt test id
command (keeping track of the IDs). Is this acceptable or should this just be a lint check? It would be convenient to auto-fix duplicate IDs, though. Is there atmt * lint --auto-fix
or something similar? @happz
To me, this sounds more like an opportunity for tmt lint
to be more useful. As you wrote at the beginning, this can happen when tests are copied and IDs are not modified - this is beyond what tmt test id
can control because it has not been called to manage said IDs. I'm afraid we cannot prevent users from doing this kind of stuff, and tmt test id
itself uses some magic to create unique IDs whenever it gets called, so the best option I see is to at least let the user know via linter there's a problem they brought on their heads :) Therefore I see no need for tmt test id
to be concerned with anything but the given test.
It would be convenient to auto-fix duplicate IDs, though. Is there a tmt * lint --auto-fix or something similar? @happz
There is a --fix
option, e.g. https://github.com/teemtee/tmt/blob/main/tmt/base.py#L1481 uses it, so we can assign a new ID to test if asked to do so. But while technically possible, I'm not sure if tmt should do it: let's say there are two tests with the same ID, which one of them is wrong? tmt creates IDs with the help of the uuid4()
function, there is nothing related to the test reflected in the ID, so which one of those two tests should we fix? :)
from tmt.
There is a --fix option, e.g. https://github.com/teemtee/tmt/blob/main/tmt/base.py#L1481 uses it, so we can assign a new ID to test if asked to do so. But while technically possible, I'm not sure if tmt should do it: let's say there are two tests with the same ID, which one of them is wrong? tmt creates IDs with the help of the uuid4() function, there is nothing related to the test reflected in the ID, so which one of those two tests should we fix? :)
Initially, I assumed that it doesn't matter which test gets the new UUID assigned. Thinking about it, however, this is not true.
So the best solution is to extend tmt lint
and list the tests containing any duplicate UUIDs found. Thanks for your help! @happz
I'd be up for implementing this issue :) Could you assign it to me?
from tmt.
We don't have a linter level that would focus on the repository, to consider objects as they are in it. We have tmt test lint
which basically means "all tests", but can be executed for a subset too, tmt test lint /tests/foo/
. So you will need some pre-lint step in code where a set of all IDs would be collected, then the check would be able to check this container and find out whether any of its IDs have more than one owner listed.
Or you can build the storage as you go, one by one, but then it would report no conflict if called for just one of the tests from that conflicting pair. It might be acceptable, I for one would not mind, because, eventually, I run tmt lint
which sees everything in pre-commit, so I would learn about conflicts before committing.
from tmt.
Related Issues (20)
- Ansible package dependency for prepare, finish steps
- Ansible package dependency for prepare, finish steps
- Expose CLI invocation reset HOT 1
- Deprecation warning with docutils `frontend.OptionParser`
- `test.require` does not work with `context.distro` HOT 2
- Adjust on `provision.how` HOT 4
- Installing a local package does not work
- "Check first" and "Skip broken" flags are broken for installation of packages provided as files HOT 1
- Hard to debug `tmt plans ls` with remote plans HOT 1
- Ansible prepare step of imported plan does not work HOT 1
- 1.33 regression: `dist-git-source` behaves differently in different provisions HOT 5
- 1.33 regression: Ssh fails with tmt-reproducer.sh HOT 2
- Enable `vcpu`s number for `virtual` provisioning step HOT 1
- Load `resource_files` from external project
- Require an explicit user confirmation that 'provision -h local' can be executed'
- Suggesting additional sources for test requirements HOT 2
- All `tmt try` to accept generic steps options from `tmt run` HOT 6
- Prepare step should allow the run to continue on missing test requirements HOT 1
- Allow custom failure patterns in dmesg in test plan
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmt.