test: full width for CI testing [ci skip]
Also clean up the .env.sample.
This commit is contained in:
parent
05489a129c
commit
827edcb0da
@ -1,7 +1,7 @@
|
|||||||
go env -w GOPRIVATE=coopcloud.tech
|
# integration test suite
|
||||||
|
|
||||||
# export PASSWORD_STORE_DIR=$(pwd)/../../autonomic/passwords/passwords/
|
|
||||||
|
|
||||||
# export ABRA_DIR="$HOME/.abra_test"
|
# export ABRA_DIR="$HOME/.abra_test"
|
||||||
# export ABRA_TEST_DOMAIN=test.example.com
|
# export ABRA_TEST_DOMAIN=test.example.com
|
||||||
# export ABRA_SKIP_TEARDOWN=1 # for faster feedback when developing tests
|
# export ABRA_CI=1
|
||||||
|
|
||||||
|
# release automation
|
||||||
|
# export GITEA_TOKEN=
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -42,22 +43,33 @@ func HumanDuration(timestamp int64) string {
|
|||||||
|
|
||||||
// CreateTable prepares a table layout for output.
|
// CreateTable prepares a table layout for output.
|
||||||
func CreateTable() (*table.Table, error) {
|
func CreateTable() (*table.Table, error) {
|
||||||
|
table := table.New().
|
||||||
|
Border(lipgloss.ThickBorder()).
|
||||||
|
BorderStyle(
|
||||||
|
lipgloss.NewStyle().
|
||||||
|
Foreground(lipgloss.Color("63")),
|
||||||
|
)
|
||||||
|
|
||||||
|
if isAbraCI, ok := os.LookupEnv("ABRA_CI"); ok && isAbraCI == "1" {
|
||||||
|
// NOTE(d1): no width limits for CI testing since we test against outputs
|
||||||
|
log.Debug("detected ABRA_CI=1")
|
||||||
|
return table, nil
|
||||||
|
}
|
||||||
|
|
||||||
width, _, err := term.GetSize(0)
|
width, _, err := term.GetSize(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if width-10 < 79 {
|
if width-10 < 79 {
|
||||||
width = 79
|
// NOTE(d1): maintain standard minimum width
|
||||||
|
table.Width(79)
|
||||||
|
} else {
|
||||||
|
// NOTE(d1): tests show that this produces stable border drawing
|
||||||
|
table.Width(width - 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
return table.New().
|
return table, nil
|
||||||
Width(width - 10).
|
|
||||||
Border(lipgloss.ThickBorder()).
|
|
||||||
BorderStyle(
|
|
||||||
lipgloss.NewStyle().
|
|
||||||
Foreground(lipgloss.Color("63")),
|
|
||||||
), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToJSON converts a lipgloss.Table to JSON representation. It's not a robust
|
// ToJSON converts a lipgloss.Table to JSON representation. It's not a robust
|
||||||
|
@ -72,6 +72,7 @@ echo "========================================================================"
|
|||||||
export ABRA_DIR="$HOME/.abra_test"
|
export ABRA_DIR="$HOME/.abra_test"
|
||||||
export TERM=xterm
|
export TERM=xterm
|
||||||
export TEST_SERVER=default
|
export TEST_SERVER=default
|
||||||
|
export ABRA_CI=1
|
||||||
|
|
||||||
rm -rf "$ABRA_DIR"
|
rm -rf "$ABRA_DIR"
|
||||||
bats -Tp tests/integration --filter-tags \!dns --print-output-on-failure
|
bats -Tp tests/integration --filter-tags \!dns --print-output-on-failure
|
||||||
|
Loading…
x
Reference in New Issue
Block a user