Provider acceptance testing failed: Error: Inconsistent dependency lock file

Hi,
I’m trying to run acc test in my provider but got stderr " Too many command line arguments." below,while checking terraform args i saw “/var/folders/8r/52c0yg194qgddbm_094n1rjw0000gn/T/tftest1078024979/work2827497763/config1784333546” in terraform log,:frowning:
— FAIL: TestAccxxx_contentCreate (0.10s)
testing_new.go:79: init failed: terraform failed: exit status 1

    stderr:
    Too many command line arguments. Did you mean to use -chdir?

FAIL
exit status 1
FAIL terraform-provider-xxxcloud/xxxcloud/rapxxx/dashboard 0.652s

I solved this problem by upgrading terraform-plugin-sdk but now i meet a new error
— FAIL: TestAccxxxx_contentCreate (0.23s)
content_test.go:21: exit status 1

    Error: Inconsistent dependency lock file
    
    The following dependency selections recorded in the lock file are
    inconsistent with the current configuration:
      - provider hashicorp.com/edu/xxxcloud: required by this configuration but no version is selected
    
    To make the initial dependency selections that will initialize the dependency
    lock file, run:
      terraform init
//accxxx_test.go
func TestAccxxx_contentCreate(t *testing.T) {
	resourceName := "xxxcloud_xxx_content.test"
	rName := "content_test"

	resource.ParallelTest(t, resource.TestCase{
		PreCheck:          func() {},
		ProviderFactories: acctest.ProviderFactories,
		CheckDestroy:      testAccCheckContentDestroy,
		Steps: []resource.TestStep{
			{
				Config: testAccContentConfig(rName),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckContentExists(resourceName),
				),
			},
		},
	})
}

func testAccCheckContentExists(n string) resource.TestCheckFunc {
	return testAccCheckContentExistsWithProvider(n, func() *schema.Provider { return acctest.Provider })
}

func testAccCheckContentExistsWithProvider(n string, providerF func() *schema.Provider) resource.TestCheckFunc {
	return func(s *terraform.State) error {

		rs, ok := s.RootModule().Resources[n]
		if !ok {
			return fmt.Errorf("Not found: %s", n)
		}

		if rs.Primary.ID == "" {
			return fmt.Errorf("No ID is set")
		}

		provider := providerF()
		conn := provider.Meta().(*conns.XXXClient).RaptorClient
		pid := rs.Primary.ID
		rid, err := dashboard.Parseid(pid)
		if err != nil {
			return err
		}
		resp, err := conn.QueryContent(rid.Bg, rid.Bu, rid.Parent, rid.Did)
		if err != nil {
			return nil
		}
		if resp.Result.ID == rid.Did {
			return nil
		}
		return fmt.Errorf("ID not equal want:[%d] but got [%d]", rid.Did, resp.Result.ID)
	}
}

func testAccCheckContentDestroy(s *terraform.State) error {
	return testAccCheckContentDestroyWithProvider(s, acctest.Provider)
}

func testAccCheckContentDestroyWithProvider(s *terraform.State, provider *schema.Provider) error {
	conn := provider.Meta().(*conns.XXXClient).XXXXXClient

	for _, rs := range s.RootModule().Resources {
		if rs.Type != "xxxcloud_xxxxx_content" {
			continue
		}
		pid := rs.Primary.ID
		rid, err := dashboard.Parseid(pid)
		if err != nil {
			return err
		}
		resp, err := conn.QueryContent(rid.Bg, rid.Bu, rid.Parent, rid.Did)
		if err != nil {
			return err
		}
		fmt.Println(resp)
	}

	return nil

}

func testAccContentConfig(name string) string {
	return fmt.Sprintf(`
     terraform {

  required_providers {
    mwscloud = {
      version = "0.2.0"
      source  = "hashicorp.com/edu/xxxscloud"
    }
  }
}
provider "xxxcloud" {
  xxx_host = "http://xxxx.xxx.com"
 xxx_token = "xxxbcfxxc5xxxxxxx"
}
resource "xxxcloud_xxx_content" "test" {
        bg     = 7
        bu     = 45
        parent = 74984
        name   = "%s"
        desc   = "should no exist"
  }
      `, name)
}
//acctest.go
const (
	ProviderName          = "xxxcloud"
	ProviderNameAlternate = "xxxcloudalternate"
	ResourcePrefix        = "tf-acc-test"
)

var Providers map[string]*schema.Provider

var ProviderFactories map[string]func() (*schema.Provider, error)

var Provider *schema.Provider

func init() {
	Provider = provider.Provider()

	Providers = map[string]*schema.Provider{
		ProviderName: Provider,
	}

	ProviderFactories = map[string]func() (*schema.Provider, error){
		ProviderName: func() (*schema.Provider, error) { return provider.Provider(), nil },
	}
}

func factoriesInit(providers *[]*schema.Provider, providerNames []string) map[string]func() (*schema.Provider, error) {
	var factories = make(map[string]func() (*schema.Provider, error), len(providerNames))
	for _, name := range providerNames {
		p := provider.Provider()

		factories[name] = func() (*schema.Provider, error) {
			return p, nil
		}

		if providers != nil {
			*providers = append(*providers, p)
		}
	}

	return factories
}

func FactoriesInternal(providers *[]*schema.Provider) map[string]func() (*schema.Provider, error) {
	return factoriesInit(providers, []string{ProviderName})
}


env:
macOS 12.4
Terraform v1.3.0-dev

Thanks~

I know this is an old post, but were you able to solve the lock file error?