github.com/adacta-ru/mattermost-server/v6@v6.0.0/services/slackimport/main_test.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See LICENSE.txt for license information. 3 4 package slackimport 5 6 import ( 7 "fmt" 8 "os" 9 "testing" 10 11 "github.com/adacta-ru/mattermost-server/v6/mlog" 12 ) 13 14 func TestMain(m *testing.M) { 15 prevDir, err := os.Getwd() 16 if err != nil { 17 panic("Failed to get current working directory: " + err.Error()) 18 } 19 20 err = os.Chdir("../..") 21 if err != nil { 22 panic(fmt.Sprintf("Failed to set current working directory to %s: %s", "../..", err.Error())) 23 } 24 25 mlog.DisableZap() 26 27 defer func() { 28 err := os.Chdir(prevDir) 29 if err != nil { 30 panic(fmt.Sprintf("Failed to restore current working directory to %s: %s", prevDir, err.Error())) 31 } 32 }() 33 34 m.Run() 35 }