@@ -598,3 +598,103 @@ func TestStorageSuppressDiff(t *testing.T) {
598598 require .False (t , suppressStorageDiff (k , generated , "/tmp/abc" , nil ))
599599 require .False (t , suppressStorageDiff (k , "/tmp/abc" , "" , nil ))
600600}
601+
602+ func TestResourcePipelineCreateServerless (t * testing.T ) {
603+ var serverlessPipelineSpec = PipelineSpec {
604+ Name : "test-pipeline-serverless" ,
605+ Storage : "/test/storage" ,
606+ Configuration : map [string ]string {
607+ "key1" : "value1" ,
608+ "key2" : "value2" ,
609+ },
610+ Clusters : []pipelineCluster {
611+ {
612+ Label : "default" ,
613+ CustomTags : map [string ]string {
614+ "cluster_tag1" : "cluster_value1" ,
615+ },
616+ },
617+ },
618+ Libraries : []PipelineLibrary {
619+ {
620+ Notebook : & NotebookLibrary {
621+ Path : "/TestServerless" ,
622+ },
623+ },
624+ },
625+ Filters : & filters {
626+ Include : []string {"com.databricks.include" },
627+ Exclude : []string {"com.databricks.exclude" },
628+ },
629+ Serverless : true ,
630+ }
631+ d , err := qa.ResourceFixture {
632+ Fixtures : []qa.HTTPFixture {
633+ {
634+ Method : "POST" ,
635+ Resource : "/api/2.0/pipelines" ,
636+ Response : createPipelineResponse {
637+ PipelineID : "serverless" ,
638+ },
639+ },
640+ {
641+ Method : "GET" ,
642+ Resource : "/api/2.0/pipelines/serverless" ,
643+ Response : map [string ]any {
644+ "id" : "serverless" ,
645+ "name" : "test-pipeline-serverless" ,
646+ "state" : "DEPLOYING" ,
647+ "spec" : serverlessPipelineSpec ,
648+ },
649+ },
650+ {
651+ Method : "GET" ,
652+ Resource : "/api/2.0/pipelines/serverless" ,
653+ Response : map [string ]any {
654+ "id" : "serverless" ,
655+ "name" : "test-pipeline-serverless" ,
656+ "state" : "RUNNING" ,
657+ "spec" : serverlessPipelineSpec ,
658+ },
659+ },
660+ {
661+ Method : "GET" ,
662+ Resource : "/api/2.0/pipelines/serverless" ,
663+ Response : map [string ]any {
664+ "id" : "serverless" ,
665+ "name" : "test-pipeline-serverless" ,
666+ "state" : "RUNNING" ,
667+ "spec" : serverlessPipelineSpec ,
668+ },
669+ },
670+ },
671+ Create : true ,
672+ Resource : ResourcePipeline (),
673+ HCL : `name = "test-pipeline-serverless"
674+ storage = "/test/storage"
675+ configuration = {
676+ key1 = "value1"
677+ key2 = "value2"
678+ }
679+ cluster {
680+ label = "default"
681+ custom_tags = {
682+ "cluster_tag1" = "cluster_value1"
683+ }
684+ }
685+ library {
686+ notebook {
687+ path = "/TestServerless"
688+ }
689+ }
690+ filters {
691+ include = ["com.databricks.include"]
692+ exclude = ["com.databricks.exclude"]
693+ }
694+ continuous = false
695+ serverless = true
696+ ` ,
697+ }.Apply (t )
698+ assert .NoError (t , err )
699+ assert .Equal (t , "serverless" , d .Id ())
700+ }
0 commit comments