Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

add basic test framework for cmd line tests #498

Merged
merged 1 commit into from
Jan 3, 2018

Conversation

surajssd
Copy link
Member

No description provided.

@cdrage
Copy link
Collaborator

cdrage commented Dec 4, 2017

@surajssd I believe you need to do a vendor update to grab that one package you added 👍

Copy link
Collaborator

@cdrage cdrage left a comment

Choose a reason for hiding this comment

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

Code LGTM, I just need to run-through and test this.

}

func runCmd(t *testing.T, args []string) (string, error) {
cmd := exec.Command("kedge", args...)
Copy link
Collaborator

Choose a reason for hiding this comment

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

might be good to make kedge a global variable just-in-case we port this code to another project (hint: kompose, haha)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@surajssd surajssd force-pushed the cmd-test-framework branch 2 times, most recently from 1a322b2 to e869e69 Compare December 5, 2017 11:10
}{
{
name: "multiple configmaps given and name not specified",
command: []string{"generate", "-f=" + Fixtures + "multi-configmapname/app.yaml"},
Copy link
Member

@kadel kadel Dec 11, 2017

Choose a reason for hiding this comment

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

this test just generates an all the files are always in Fixtures dir.
It would be more readable to specify just file/dir path.

testCases := []struct {
 	name        string
 	path         string
 	input       string
 	wantSuccess bool
 	error       string
 }{
       {
          name: "multiple configmaps given and name not specified", 
          path:  "multi-configmapname/app.yaml"
...

proper command can be build inside for loop before test is run

Copy link
Member Author

Choose a reason for hiding this comment

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

done!

@surajssd
Copy link
Member Author

@cdrage @kadel can you guys take a look at it?

@kadel kadel merged commit ce58911 into kedgeproject:master Jan 3, 2018
@surajssd surajssd deleted the cmd-test-framework branch January 4, 2018 01:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants