-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21c9cae
commit 194cae9
Showing
2 changed files
with
120 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,127 @@ | ||
// package pipelines | ||
|
||
// import ( | ||
// "testing" | ||
package pipelines | ||
|
||
// "github.com/databricks/terraform-provider-databricks/qa" | ||
// ) | ||
import ( | ||
"testing" | ||
|
||
// func TestDataSourcePipeline_Error(t *testing.T) { | ||
// qa.ResourceFixture{ | ||
// Fixtures: qa.HTTPFailures, | ||
// Resource: DataSourcePipelines(), | ||
// Read: true, | ||
// NonWritable: true, | ||
// ID: "_", | ||
// }.ExpectError(t, "i'm a teapot") | ||
// } | ||
"github.com/databricks/terraform-provider-databricks/qa" | ||
) | ||
|
||
// func TestDataSourcePipelines(t *testing.T) { | ||
// qa.ResourceFixture{ | ||
// Fixtures: []qa.HTTPFixture{ | ||
// { | ||
// Method: "GET", | ||
// Resource: "/api/2.0/pipelines?max_results=100", | ||
// Response: PipelineListResponse{ | ||
// Statuses: []PipelineStateInfo{ | ||
// { | ||
// PipelineID: "123", | ||
// Name: "Pipeline1", | ||
// CreatorUserName: "user1", | ||
// }, | ||
// }, | ||
// }, | ||
// }, | ||
// { | ||
// Method: "GET", | ||
// Resource: "/api/2.0/pipelines?max_results=100&page_token=token1", | ||
// Response: PipelineListResponse{ | ||
// Statuses: []PipelineStateInfo{ | ||
// { | ||
// PipelineID: "123", | ||
// Name: "Pipeline1", | ||
// CreatorUserName: "user1", | ||
// }, | ||
// }, | ||
// NextPageToken: "token1", | ||
// }, | ||
// }, | ||
// }, | ||
// Resource: DataSourcePipelines(), | ||
// Read: true, | ||
// NonWritable: true, | ||
// ID: "_", | ||
// }.ApplyAndExpectData(t, map[string]any{ | ||
// "ids": []string{ | ||
// "123", | ||
// }, | ||
// }) | ||
// } | ||
func TestDataSourcePipeline_Error(t *testing.T) { | ||
qa.ResourceFixture{ | ||
Fixtures: qa.HTTPFailures, | ||
Resource: DataSourcePipelines(), | ||
Read: true, | ||
NonWritable: true, | ||
ID: "_", | ||
}.ExpectError(t, "i'm a teapot") | ||
} | ||
|
||
// func TestDataSourcePipelines_Search(t *testing.T) { | ||
// qa.ResourceFixture{ | ||
// Fixtures: []qa.HTTPFixture{ | ||
// { | ||
// Method: "GET", | ||
// Resource: "/api/2.0/pipelines?filter=name+LIKE+%27Pipeline1%27&max_results=100", | ||
// Response: PipelineListResponse{ | ||
// Statuses: []PipelineStateInfo{ | ||
// { | ||
// PipelineID: "123", | ||
// Name: "Pipeline1", | ||
// CreatorUserName: "user1", | ||
// }, | ||
// }, | ||
// }, | ||
// }, | ||
// }, | ||
// Resource: DataSourcePipelines(), | ||
// HCL: `pipeline_name = "Pipeline1"`, | ||
// Read: true, | ||
// NonWritable: true, | ||
// //Create: true, | ||
// ID: "_", | ||
// }.ApplyAndExpectData(t, map[string]any{ | ||
// "ids": []string{ | ||
// "123", | ||
// }, | ||
// }) | ||
// } | ||
func TestDataSourcePipelines(t *testing.T) { | ||
qa.ResourceFixture{ | ||
Fixtures: []qa.HTTPFixture{ | ||
{ | ||
Method: "GET", | ||
Resource: "/api/2.0/pipelines?max_results=100", | ||
Response: PipelineListResponse{ | ||
Statuses: []PipelineStateInfo{ | ||
{ | ||
PipelineID: "123", | ||
Name: "Pipeline1", | ||
CreatorUserName: "user1", | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
Method: "GET", | ||
Resource: "/api/2.0/pipelines?max_results=100&page_token=token1", | ||
Response: PipelineListResponse{ | ||
Statuses: []PipelineStateInfo{ | ||
{ | ||
PipelineID: "123", | ||
Name: "Pipeline1", | ||
CreatorUserName: "user1", | ||
}, | ||
}, | ||
NextPageToken: "token1", | ||
}, | ||
}, | ||
}, | ||
Resource: DataSourcePipelines(), | ||
Read: true, | ||
NonWritable: true, | ||
ID: "_", | ||
}.ApplyAndExpectData(t, map[string]any{ | ||
"ids": []string{ | ||
"123", | ||
}, | ||
}) | ||
} | ||
|
||
// func TestDataSourcePipelines_SearchError(t *testing.T) { | ||
// //_, err := qa.ResourceFixture{ | ||
// qa.ResourceFixture{ | ||
// Fixtures: []qa.HTTPFixture{ | ||
// { | ||
// Method: "GET", | ||
// Resource: "/api/2.0/pipelines?filter=name+LIKE+%27Pipeline2%27&max_results=100", | ||
// Response: PipelineListResponse{}, | ||
// }, | ||
// }, | ||
// Resource: DataSourcePipelines(), | ||
// HCL: `pipeline_name = "Pipeline2"`, | ||
// Read: true, | ||
// NonWritable: true, | ||
// //Create: true, | ||
// ID: "_", | ||
// }.ApplyNoError(t) | ||
// } | ||
func TestDataSourcePipelines_Search(t *testing.T) { | ||
qa.ResourceFixture{ | ||
Fixtures: []qa.HTTPFixture{ | ||
{ | ||
Method: "GET", | ||
Resource: "/api/2.0/pipelines?filter=name+LIKE+%27Pipeline1%27&max_results=100", | ||
Response: PipelineListResponse{ | ||
Statuses: []PipelineStateInfo{ | ||
{ | ||
PipelineID: "123", | ||
Name: "Pipeline1", | ||
CreatorUserName: "user1", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
Resource: DataSourcePipelines(), | ||
HCL: `pipeline_name = "Pipeline1"`, | ||
Read: true, | ||
NonWritable: true, | ||
//Create: true, | ||
ID: "_", | ||
}.ApplyAndExpectData(t, map[string]any{ | ||
"ids": []string{ | ||
"123", | ||
}, | ||
}) | ||
} | ||
|
||
// func TestDataSourcePipelines_NoneFound(t *testing.T) { | ||
// //_, err := qa.ResourceFixture{ | ||
// qa.ResourceFixture{ | ||
// Fixtures: []qa.HTTPFixture{ | ||
// { | ||
// Method: "GET", | ||
// Resource: "/api/2.0/pipelines?max_results=100", | ||
// Response: PipelineListResponse{}, | ||
// }, | ||
// }, | ||
// Resource: DataSourcePipelines(), | ||
// HCL: `pipeline_name = ""`, | ||
// Read: true, | ||
// NonWritable: true, | ||
// //Create: true, | ||
// ID: "_", | ||
// }.ApplyNoError(t) | ||
// } | ||
func TestDataSourcePipelines_SearchError(t *testing.T) { | ||
//_, err := qa.ResourceFixture{ | ||
qa.ResourceFixture{ | ||
Fixtures: []qa.HTTPFixture{ | ||
{ | ||
Method: "GET", | ||
Resource: "/api/2.0/pipelines?filter=name+LIKE+%27Pipeline2%27&max_results=100", | ||
Response: PipelineListResponse{}, | ||
}, | ||
}, | ||
Resource: DataSourcePipelines(), | ||
HCL: `pipeline_name = "Pipeline2"`, | ||
Read: true, | ||
NonWritable: true, | ||
//Create: true, | ||
ID: "_", | ||
}.ApplyNoError(t) | ||
} | ||
|
||
package pipelines | ||
func TestDataSourcePipelines_NoneFound(t *testing.T) { | ||
//_, err := qa.ResourceFixture{ | ||
qa.ResourceFixture{ | ||
Fixtures: []qa.HTTPFixture{ | ||
{ | ||
Method: "GET", | ||
Resource: "/api/2.0/pipelines?max_results=100", | ||
Response: PipelineListResponse{}, | ||
}, | ||
}, | ||
Resource: DataSourcePipelines(), | ||
HCL: `pipeline_name = ""`, | ||
Read: true, | ||
NonWritable: true, | ||
//Create: true, | ||
ID: "_", | ||
}.ApplyNoError(t) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters