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

Another mechanism for command extraction during tests #1445

Open
max-dw-i opened this issue Aug 16, 2023 · 4 comments
Open

Another mechanism for command extraction during tests #1445

max-dw-i opened this issue Aug 16, 2023 · 4 comments

Comments

@max-dw-i
Copy link
Contributor

max-dw-i commented Aug 16, 2023

At the moment commands are extracted from directory names during tests. It works nice when the command does not have any 'special' characters in it. But some commands do have 'special' characters. For example, command :put [:resolve ...] on mikrotik_routeros. On LInux it's ok but Windows won't even allow to make a directory/file with such characters in the name.

Even if we are going to use only Linux, it's still broken here cause glob treats square brackets specially.

Maybe it makes sense to add a new file with the *.cmd extension (similar to current *.raw, *.yml) with the test command in it. Or another way to use tests for commands with 'special' characters.

@jvanderaa
Copy link
Contributor

Does it work within Docker on Windows?

@max-dw-i
Copy link
Contributor Author

I don't have Windows at hand but since the base image in the dockerfile is python-slim (which uses Debian under the hood), I'm pretty sure it's going to work. If docker-based development is the only officially supported option, it's not a problem, I guess.

But still such commands (with square brackets, semicolons and other special characters) makes directory/file names less readable (in my opinion, of course).

So I'm curious whether it's a good idea to make a more general way of getting commands during tests (not from directory paths)?

And if the decision is that extracting commands from directories' names is fine then this thing

Even if we are going to use only Linux, it's still broken here cause glob treats square brackets specially.

still should be fixed (I could prepare PR).

@mjbear
Copy link
Contributor

mjbear commented Aug 3, 2024

At the moment commands are extracted from directory names during tests. It works nice when the command does not have any 'special' characters in it. But some commands do have 'special' characters. For example, command :put [:resolve ...] on mikrotik_routeros. On LInux it's ok but Windows won't even allow to make a directory/file with such characters in the name.

@max-dw-i
I was curious about this issue ticket so I started looking into it.
There are not any template test data directories that include special characters such as square brackets [ ].

It is pretty simple the way things are now.
If there truly becomes a problem maybe it's just a matter of escaping characters (ex: glob.escape()) as an alternative.

@itdependsnetworks
Copy link
Contributor

We should probably run it through a "slugify" like filter.

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

No branches or pull requests

4 participants