github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/command/e2etest/module_archive_test.go (about)

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