github.com/opentofu/opentofu@v1.7.1/internal/command/e2etest/module_archive_test.go (about) 1 // Copyright (c) The OpenTofu Authors 2 // SPDX-License-Identifier: MPL-2.0 3 // Copyright (c) 2023 HashiCorp, Inc. 4 // SPDX-License-Identifier: MPL-2.0 5 6 package e2etest 7 8 import ( 9 "path/filepath" 10 "strings" 11 "testing" 12 13 "github.com/opentofu/opentofu/internal/e2e" 14 ) 15 16 func TestInitModuleArchive(t *testing.T) { 17 t.Parallel() 18 19 // this fetches a module archive from github 20 skipIfCannotAccessNetwork(t) 21 22 fixturePath := filepath.Join("testdata", "module-archive") 23 tf := e2e.NewBinary(t, tofuBin, fixturePath) 24 25 stdout, stderr, err := tf.Run("init") 26 if err != nil { 27 t.Errorf("unexpected error: %s", err) 28 } 29 30 if stderr != "" { 31 t.Errorf("unexpected stderr output:\n%s", stderr) 32 } 33 34 if !strings.Contains(stdout, "OpenTofu has been successfully initialized!") { 35 t.Errorf("success message is missing from output:\n%s", stdout) 36 } 37 }