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

Venom: Support for .yml & .yaml extensions #495

Merged
merged 1 commit into from
Jan 25, 2022
Merged

Venom: Support for .yml & .yaml extensions #495

merged 1 commit into from
Jan 25, 2022

Conversation

scraly
Copy link
Collaborator

@scraly scraly commented Jan 25, 2022

Observation

For this PR I started from an observation:

By default, venom CLI take in account .yml extension.
If it found .yml file, no need to specify them in the venom run command line:

$ tree /Users/avache/tmp/venom/2 ; go run main.go run /Users/avache/tmp/venom/2
/Users/avache/tmp/venom/2
└── testsuite.yml

0 directories, 1 file
	  [trac] writing venom.log
 • APIIntegrationTest (/Users/avache/tmp/venom/2/testsuite.yml)
 	• GET-http-testcase-with-5-seconds-timeout SUCCESS

But it does not support .yaml extension file:

$ tree /Users/avache/tmp/venom/1 ; go run main.go run /Users/avache/tmp/venom/1
/Users/avache/tmp/venom/1
└── testsuite.yaml

0 directories, 1 file
	  [trac] writing venom.log
no yml file selected
exit status 2

But:

  • YAML recommend that we use .yaml extension (https://yaml.org/faq.html)
  • We can see people using .yml or .yaml extension for YAML files, depending all the time

And: « no yaml file selected », the text message is not very true because we have a YAML file but not in the extension it wanted to :) .

Sometimes in the code we supports both:

for _, fp := range fpaths {
			switch ext := filepath.Ext(fp); ext {
			case ".yml", ".yaml":
				filePaths = append(filePaths, fp)
			}
		}

But not in the example I show previously for the venom run command support by default.

Solution

So I recommend that Venom need to supports both .yml and .yaml extensions, not only .yml by default, all the time.

New behavior after the feature coded in the PR

Both .yml and .yaml are now supported by default:

$  tree /Users/avache/tmp/venom/1 ; go run main.go run /Users/avache/tmp/venom/1
/Users/avache/tmp/venom/1
└── testsuite.yaml

0 directories, 1 file
	  [trac] writing venom.log
[/Users/avache/tmp/venom/1]
 • APIIntegrationTest (/Users/avache/tmp/venom/1/testsuite.yaml)
 	• GET-http-testcase-with-5-seconds-timeout SUCCESS
$  tree /Users/avache/tmp/venom/2 ; go run main.go run /Users/avache/tmp/venom/2
/Users/avache/tmp/venom/2
└── testsuite.yml

0 directories, 1 file
	  [trac] writing venom.log
[/Users/avache/tmp/venom/2]
 • APIIntegrationTest (/Users/avache/tmp/venom/2/testsuite.yml)
 	• GET-http-testcase-with-5-seconds-timeout SUCCESS

Copy link
Member

@fsamin fsamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for your contribution 👍

LGTM

@sonarcloud
Copy link

sonarcloud bot commented Jan 25, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@yesnault yesnault merged commit 78358f5 into master Jan 25, 2022
@yesnault
Copy link
Member

thank you @scraly !

@fsamin fsamin deleted the yaml-support branch April 5, 2022 14:41
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

Successfully merging this pull request may close these issues.

3 participants