Skip to content

Commit

Permalink
fixed some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Divyansh-db committed Jul 26, 2024
1 parent 21c9cae commit 194cae9
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 123 deletions.
242 changes: 120 additions & 122 deletions pipelines/data_pipelines_test.go
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{

Check failure on line 25 in pipelines/data_pipelines_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: PipelineListResponse
Statuses: []PipelineStateInfo{

Check failure on line 26 in pipelines/data_pipelines_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: PipelineStateInfo
{
PipelineID: "123",
Name: "Pipeline1",
CreatorUserName: "user1",
},
},
},
},
{
Method: "GET",
Resource: "/api/2.0/pipelines?max_results=100&page_token=token1",
Response: PipelineListResponse{

Check failure on line 38 in pipelines/data_pipelines_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: PipelineListResponse
Statuses: []PipelineStateInfo{

Check failure on line 39 in pipelines/data_pipelines_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: 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{

Check failure on line 67 in pipelines/data_pipelines_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: PipelineListResponse
Statuses: []PipelineStateInfo{

Check failure on line 68 in pipelines/data_pipelines_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: 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{},

Check failure on line 98 in pipelines/data_pipelines_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: 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{},

Check failure on line 117 in pipelines/data_pipelines_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: PipelineListResponse (compile)
},
},
Resource: DataSourcePipelines(),
HCL: `pipeline_name = ""`,
Read: true,
NonWritable: true,
//Create: true,
ID: "_",
}.ApplyNoError(t)
}
1 change: 0 additions & 1 deletion provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"github.com/databricks/terraform-provider-databricks/mws"
"github.com/databricks/terraform-provider-databricks/permissions"
"github.com/databricks/terraform-provider-databricks/pipelines"

"github.com/databricks/terraform-provider-databricks/policies"
"github.com/databricks/terraform-provider-databricks/pools"
"github.com/databricks/terraform-provider-databricks/repos"
Expand Down

0 comments on commit 194cae9

Please sign in to comment.