Skip to content

Commit

Permalink
fix client
Browse files Browse the repository at this point in the history
  • Loading branch information
freeznet committed Sep 30, 2024
1 parent 8b93f34 commit 95fbe68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions pulsar/resource_pulsar_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package pulsar
import (
"errors"
"fmt"
"io/ioutil"
"os"
"strings"
"testing"

Expand All @@ -36,7 +36,7 @@ func init() {
}

func TestFunction(t *testing.T) {
configBytes, err := ioutil.ReadFile("testdata/function/main.tf")
configBytes, err := os.ReadFile("testdata/function/main.tf")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -101,7 +101,7 @@ func testPulsarFunctionDestroy(s *terraform.State) error {
}

func getPulsarFunctionByResourceID(id string) (*utils.FunctionConfig, error) {
client := getClientFromMeta(testAccProvider.Meta()).Functions()
client := getV3ClientFromMeta(testAccProvider.Meta()).Functions()

parts := strings.Split(id, "/")
if len(parts) != 3 {
Expand Down
8 changes: 4 additions & 4 deletions pulsar/resource_pulsar_sink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestSink(t *testing.T) {
}

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheckWithAPIVersion(t, config.V3) },
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories,
PreventPostDestroyRefresh: false,
CheckDestroy: testPulsarSinkDestroy,
Expand All @@ -64,7 +64,7 @@ func TestSink(t *testing.T) {
return fmt.Errorf("%s not be found", name)
}

client := getClientFromMeta(testAccProvider.Meta()).Sinks()
client := getV3ClientFromMeta(testAccProvider.Meta()).Sinks()

parts := strings.Split(rs.Primary.ID, "/")
if len(parts) != 3 {
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestSinkUpdate(t *testing.T) {
configString = strings.ReplaceAll(configString, "sink-1", "update-sink-test-1")

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheckWithAPIVersion(t, config.V3) },
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories,
PreventPostDestroyRefresh: false,
CheckDestroy: testPulsarSinkDestroy,
Expand All @@ -260,7 +260,7 @@ func TestSinkUpdate(t *testing.T) {
return fmt.Errorf("%s not be found", name)
}

client := getClientFromMeta(testAccProvider.Meta()).Sinks()
client := getV3ClientFromMeta(testAccProvider.Meta()).Sinks()

parts := strings.Split(rs.Primary.ID, "/")
if len(parts) != 3 {
Expand Down
8 changes: 4 additions & 4 deletions pulsar/resource_pulsar_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package pulsar
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strings"
"testing"

Expand All @@ -44,13 +44,13 @@ var testdataSourceArchive = "https://www.apache.org/dyn/mirrors/mirrors.cgi" +
"?action=download&filename=pulsar/pulsar-2.10.4/connectors/pulsar-io-file-2.10.4.nar"

func TestSource(t *testing.T) {
configBytes, err := ioutil.ReadFile("testdata/source/main.tf")
configBytes, err := os.ReadFile("testdata/source/main.tf")
if err != nil {
t.Fatal(err)
}

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheckWithAPIVersion(t, config.V3) },
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories,
PreventPostDestroyRefresh: false,
CheckDestroy: testPulsarSourceDestroy,
Expand Down Expand Up @@ -114,7 +114,7 @@ func testPulsarSourceDestroy(s *terraform.State) error {
}

func getPulsarSourceByResourceID(id string) (*utils.SourceConfig, error) {
client := getClientFromMeta(testAccProvider.Meta()).Sources()
client := getV3ClientFromMeta(testAccProvider.Meta()).Sources()

parts := strings.Split(id, "/")
if len(parts) != 3 {
Expand Down

0 comments on commit 95fbe68

Please sign in to comment.