Files
go-sip/internal/config/deployment_layout_test.go

26 lines
867 B
Go

package config
import (
"errors"
"os"
"path/filepath"
"testing"
)
func TestDeploymentHasOneCanonicalDirectory(t *testing.T) {
root := filepath.Join("..", "..")
if _, err := os.Stat(filepath.Join(root, "deploy")); !errors.Is(err, os.ErrNotExist) {
t.Fatalf("obsolete deploy directory must not remain: %v", err)
}
for _, path := range []string{"README.md", "build-package.sh", "install.sh", "versions.lock.json", "cell/install-asterisk-native.sh", "cell/nonprod-call-evidence.sh", "systemd/sip-go-agent-agent.service", "systemd/sip-go-agent-dispatcher.service", "config/dispatcher.json.example"} {
info, err := os.Stat(filepath.Join(root, "deploys", path))
if err != nil {
t.Errorf("canonical deployment entry %s: %v", path, err)
continue
}
if !info.Mode().IsRegular() {
t.Errorf("deployment entry %s is not a regular file", path)
}
}
}