Skip to content

Commit

Permalink
gofmt -w test/e2e/*
Browse files Browse the repository at this point in the history
format test/e2e files

partially fixes #1481

Signed-off-by: jbpratt <jbpratt78@gmail.com>
  • Loading branch information
jbpratt authored and tekton-robot committed Mar 4, 2022
1 parent 2ab9e41 commit d6a2cb3
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 48 deletions.
28 changes: 16 additions & 12 deletions test/e2e/clustertask/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func TestClusterTaskInteractiveStartE2E(t *testing.T) {
Err: icmd.None,
Out: expected,
})

})
}
t.Logf("Creating clustertask read-clustertask")
Expand Down Expand Up @@ -148,7 +147,8 @@ Waiting for logs to be available...

c.Close()
return nil
}})
},
})
taskRunGeneratedName := builder.GetTaskRunListWithClusterTaskName(c, clusterTaskName, true).Items[0].Name
if err := wait.ForTaskRunState(c, taskRunGeneratedName, wait.TaskRunSucceed(taskRunGeneratedName), "TaskRunSucceed"); err != nil {
t.Errorf("Error waiting for TaskRun to Succeed: %s", err)
Expand All @@ -170,13 +170,14 @@ Waiting for logs to be available...

t.Run("Start ClusterTask passing --param for some params and some params are not passed", func(t *testing.T) {
tkn.RunInteractiveTests(t, &cli.Prompt{
CmdArgs: []string{"clustertask", "start", clusterTaskName,
CmdArgs: []string{
"clustertask", "start", clusterTaskName,
"-i=source=" + tePipelineGitResourceName,
"--param=FILEPATH=docs",
"-w=name=shared-workspace,emptyDir=",
"--showlog"},
"--showlog",
},
Procedure: func(c *expect.Console) error {

if _, err := c.ExpectString("Value for param `FILENAME` of type `string`?"); err != nil {
return err
}
Expand All @@ -195,7 +196,8 @@ Waiting for logs to be available...

c.Close()
return nil
}})
},
})
taskRunGeneratedName := builder.GetTaskRunListWithClusterTaskName(c, clusterTaskName, true).Items[0].Name
if err := wait.ForTaskRunState(c, taskRunGeneratedName, wait.TaskRunSucceed(taskRunGeneratedName), "TaskRunSucceed"); err != nil {
t.Errorf("Error waiting for TaskRun to Succeed: %s", err)
Expand All @@ -204,13 +206,14 @@ Waiting for logs to be available...

t.Run("Start ClusterTask with --use-param-defaults and some of the params not having default", func(t *testing.T) {
tkn.RunInteractiveTests(t, &cli.Prompt{
CmdArgs: []string{"clustertask", "start", clusterTaskName,
CmdArgs: []string{
"clustertask", "start", clusterTaskName,
"-i=source=" + tePipelineGitResourceName,
"--use-param-defaults",
"-w=name=shared-workspace,emptyDir=",
"--showlog"},
"--showlog",
},
Procedure: func(c *expect.Console) error {

if _, err := c.ExpectString("Value for param `FILENAME` of type `string`?"); err != nil {
return err
}
Expand All @@ -229,7 +232,8 @@ Waiting for logs to be available...

c.Close()
return nil
}})
},
})
taskRunGeneratedName := builder.GetTaskRunListWithClusterTaskName(c, clusterTaskName, true).Items[0].Name
if err := wait.ForTaskRunState(c, taskRunGeneratedName, wait.TaskRunSucceed(taskRunGeneratedName), "TaskRunSucceed"); err != nil {
t.Errorf("Error waiting for TaskRun to Succeed: %s", err)
Expand Down Expand Up @@ -367,7 +371,8 @@ Waiting for logs to be available...

c.Close()
return nil
}})
},
})
taskRunGeneratedName := builder.GetTaskRunListWithClusterTaskName(c, clusterTaskName2, true).Items[0].Name
if err := wait.ForTaskRunState(c, taskRunGeneratedName, wait.TaskRunSucceed(taskRunGeneratedName), "TaskRunSucceed"); err != nil {
t.Errorf("Error waiting for TaskRun to Succeed: %s", err)
Expand Down Expand Up @@ -401,5 +406,4 @@ Waiting for logs to be available...
res = tkn.Run("clustertask", "list")
assert.Assert(t, !strings.Contains(res.Stdout(), clusterTaskName2))
})

}
3 changes: 2 additions & 1 deletion test/e2e/pipeline/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ Waiting for logs to be available...

c.Close()
return nil
}})
},
})
})

t.Run("Start PipelineRun with tkn pipeline start --last", func(t *testing.T) {
Expand Down
48 changes: 30 additions & 18 deletions test/e2e/pipeline/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,16 @@ func TestPipelineInteractiveStartE2E(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("Start PipelineRun using pipeline start interactively using --use-param-defaults and some of the params not having default ", func(t *testing.T) {
tkn.RunInteractiveTests(t, &cli.Prompt{
CmdArgs: []string{"pipeline", "start", "output-pipeline",
"--use-param-defaults"},
CmdArgs: []string{
"pipeline", "start", "output-pipeline",
"--use-param-defaults",
},
Procedure: func(c *expect.Console) error {
if _, err := c.ExpectString("Choose the git resource to use for source-repo:"); err != nil {
return err
Expand Down Expand Up @@ -121,13 +124,16 @@ func TestPipelineInteractiveStartE2E(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("Start PipelineRun using pipeline start interactively with --param flag and --use-param-defaults and some of the params not having default ", func(t *testing.T) {
tkn.RunInteractiveTests(t, &cli.Prompt{
CmdArgs: []string{"pipeline", "start", "output-pipeline",
"-p=FILEPATH=docs", "--use-param-defaults"},
CmdArgs: []string{
"pipeline", "start", "output-pipeline",
"-p=FILEPATH=docs", "--use-param-defaults",
},
Procedure: func(c *expect.Console) error {
if _, err := c.ExpectString("Choose the git resource to use for source-repo:"); err != nil {
return err
Expand Down Expand Up @@ -155,14 +161,17 @@ func TestPipelineInteractiveStartE2E(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("Start PipelineRun using pipeline start interactively using --use-param-defaults and params provided with -p", func(t *testing.T) {
tkn.RunInteractiveTests(t, &cli.Prompt{
CmdArgs: []string{"pipeline", "start", "output-pipeline",
CmdArgs: []string{
"pipeline", "start", "output-pipeline",
"--use-param-defaults",
"-p=FILENAME=README.md"},
"-p=FILENAME=README.md",
},
Procedure: func(c *expect.Console) error {
if _, err := c.ExpectString("Choose the git resource to use for source-repo:"); err != nil {
return err
Expand All @@ -181,14 +190,14 @@ func TestPipelineInteractiveStartE2E(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("Validate interactive pipeline logs, with follow mode (-f) ", func(t *testing.T) {
tkn.RunInteractiveTests(t, &cli.Prompt{
CmdArgs: []string{"pipeline", "logs", "-f"},
Procedure: func(c *expect.Console) error {

if _, err := c.ExpectString("Select pipelinerun:"); err != nil {
return err
}
Expand All @@ -203,7 +212,8 @@ func TestPipelineInteractiveStartE2E(t *testing.T) {

c.Close()
return nil
}})
},
})
})
}

Expand Down Expand Up @@ -282,8 +292,8 @@ func TestPipelineInteractiveStartWithNewResourceE2E(t *testing.T) {

c.Close()
return nil
}})

},
})
})

t.Run("Validate interactive pipeline logs, with follow mode (-f) ", func(t *testing.T) {
Expand All @@ -308,7 +318,8 @@ func TestPipelineInteractiveStartWithNewResourceE2E(t *testing.T) {

c.Close()
return nil
}})
},
})
})
}

Expand Down Expand Up @@ -379,7 +390,8 @@ func TestPipelineInteractiveStartWithOptionalWorkspaceE2E(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("Validate interactive pipeline logs, with follow mode (-f) ", func(t *testing.T) {
Expand All @@ -404,7 +416,7 @@ func TestPipelineInteractiveStartWithOptionalWorkspaceE2E(t *testing.T) {

c.Close()
return nil
}})
},
})
})

}
18 changes: 12 additions & 6 deletions test/e2e/resource/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ func TestCreateGitResourceInteractively(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("list single pipeline resource of git type", func(t *testing.T) {
Expand Down Expand Up @@ -217,7 +218,8 @@ func TestCreateImageResourceInteractively(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("list single pipeline resource of image type", func(t *testing.T) {
Expand Down Expand Up @@ -281,7 +283,8 @@ func TestCreateCloudEventResourceInteractively(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("list single pipeline resource of cloud event type", func(t *testing.T) {
Expand Down Expand Up @@ -447,7 +450,8 @@ func TestCreateClusterResourceInteractively(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("list single pipeline resource of cluster type", func(t *testing.T) {
Expand Down Expand Up @@ -559,7 +563,8 @@ func TestCreatePullRequestResourceInteractively(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("list single pipeline resource of pullrequest type", func(t *testing.T) {
Expand Down Expand Up @@ -667,7 +672,8 @@ func TestCreateStroageResourceInteractively(t *testing.T) {

c.Close()
return nil
}})
},
})
})

t.Run("list single pipeline resource of storage type", func(t *testing.T) {
Expand Down
27 changes: 16 additions & 11 deletions test/e2e/task/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ Waiting for logs to be available...

t.Run("Start TaskRun using tkn task start command with --use-param-defaults and some of the params not having default", func(t *testing.T) {
tkn.RunInteractiveTests(t, &cli.Prompt{
CmdArgs: []string{"task", "start", "read-task",
CmdArgs: []string{
"task", "start", "read-task",
"-i=source=" + tePipelineGitResourceName,
"--use-param-defaults",
"--showlog"},
"--showlog",
},
Procedure: func(c *expect.Console) error {

if _, err := c.ExpectString("Value for param `FILENAME` of type `string`?"); err != nil {
return err
}
Expand All @@ -126,7 +127,8 @@ Waiting for logs to be available...

c.Close()
return nil
}})
},
})
})

t.Run("Get list of TaskRuns from namespace "+namespace, func(t *testing.T) {
Expand Down Expand Up @@ -171,12 +173,13 @@ Waiting for logs to be available...

t.Run("Start TaskRun using tkn task start command with passing one param and tkn will ask for other", func(t *testing.T) {
tkn.RunInteractiveTests(t, &cli.Prompt{
CmdArgs: []string{"task", "start", "read-task",
CmdArgs: []string{
"task", "start", "read-task",
"-i=source=" + tePipelineGitResourceName,
"-p=FILEPATH=docs",
"--showlog"},
"--showlog",
},
Procedure: func(c *expect.Console) error {

if _, err := c.ExpectString("Value for param `FILENAME` of type `string`?"); err != nil {
return err
}
Expand All @@ -195,14 +198,14 @@ Waiting for logs to be available...

c.Close()
return nil
}})
},
})
})

t.Run("Validate interactive task logs, with follow mode (-f) ", func(t *testing.T) {
tkn.RunInteractiveTests(t, &cli.Prompt{
CmdArgs: []string{"task", "logs", "-f"},
Procedure: func(c *expect.Console) error {

if _, err := c.ExpectString("Select taskrun:"); err != nil {
return err
}
Expand All @@ -217,7 +220,8 @@ Waiting for logs to be available...

c.Close()
return nil
}})
},
})
})

t.Logf("Creating Task task-with-workspace in namespace: %s ", namespace)
Expand Down Expand Up @@ -384,7 +388,8 @@ Waiting for logs to be available...

c.Close()
return nil
}})
},
})
taskRunGeneratedName := builder.GetTaskRunListWithTaskName(c, "task-optional-ws", true).Items[0].Name
if err := wait.ForTaskRunState(c, taskRunGeneratedName, wait.TaskRunSucceed(taskRunGeneratedName), "TaskRunSucceed"); err != nil {
t.Errorf("Error waiting for TaskRun to Succeed: %s", err)
Expand Down

0 comments on commit d6a2cb3

Please sign in to comment.