我有这样的问题:这是我的测试用例,用于测试Azure资源是否已创建。
package test
import (
"testing"
"github.com/gruntwork-io/terratest/modules/azure"
"github.com/stretchr/testify/assert"
)
func TestResourceGroupExists(t *testing.T) {
resourceGroupName := "myResourceGroup"
// Check if the resource group exists
exists, err := azure.ResourceGroupExistsE(t, resourceGroupName)
// Assert that there are no errors and the resource group exists
assert.NoError(t, err)
assert.True(t, exists, "Resource group does not exist.")
}
字符串
当我通过这样的命令执行这段代码时:[go test -v]我得到这样的错误:
./main_test.go:14:44: cannot use t (variable of type *"testing".T) as type string in argument to azure.ResourceGroupExistsE
FAIL terratest [build failed]
型
我已经执行了这个命令来安装go依赖项。[go mod tidy]
1条答案
按热度按时间k5ifujac1#
我自己是这样解决的:
字符串