mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-20 11:57:50 +02:00
Another attempt at getting github actions to pass
This commit is contained in:
parent
d2558c8fb5
commit
2efa93762a
@ -576,7 +576,7 @@ func slsaStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("OK"))
|
||||
return
|
||||
}
|
||||
if vNum < 158 {
|
||||
if vNum < 2000000 {
|
||||
w.Write([]byte("Sigstore deployed a broken change. See https://github.com/slsa-framework/slsa-github-generator/issues/1163"))
|
||||
return
|
||||
}
|
||||
|
@ -653,6 +653,9 @@ func testUpdate(t *testing.T, tester shellTester) {
|
||||
if !isExpected {
|
||||
t.Fatalf("hishtory update returned unexpected out=%#v", out)
|
||||
}
|
||||
if strings.Contains(out, "skipping SLSA validation") {
|
||||
t.Fatalf("SLSA validation was skipped, out=%#v", out)
|
||||
}
|
||||
|
||||
// Update again and assert that it skipped the update
|
||||
out = tester.RunInteractiveShell(t, `hishtory update`)
|
||||
@ -675,6 +678,8 @@ func testUpdate(t *testing.T, tester shellTester) {
|
||||
if diff := cmp.Diff(expectedOutput, out); diff != "" {
|
||||
t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out)
|
||||
}
|
||||
|
||||
// TODO: write a test that updates from v.prev to latest rather than v.Unknown to latest
|
||||
}
|
||||
|
||||
func testRepeatedCommandThenQuery(t *testing.T, tester shellTester) {
|
||||
@ -1983,9 +1988,9 @@ echo bar`)
|
||||
// And check that it is all recorded correctly
|
||||
tester.RunInteractiveShell(t, `hishtory config-set displayed-columns 'Exit Code' git_remote Command `)
|
||||
out = tester.RunInteractiveShell(t, `hishtory query -pipefail`)
|
||||
compareGoldens(t, out, "testCustomColumns-query")
|
||||
compareGoldens(t, out, fmt.Sprintf("testCustomColumns-query-isAction=%v", (os.Getenv("GITHUB_ACTION") != "")))
|
||||
out = captureTerminalOutput(t, tester, []string{"hishtory SPACE tquery SPACE -pipefail ENTER"})
|
||||
compareGoldens(t, out, "testCustomColumns-tquery")
|
||||
compareGoldens(t, out, fmt.Sprintf("testCustomColumns-tquery-isAction=%v", (os.Getenv("GITHUB_ACTION") != "")))
|
||||
}
|
||||
|
||||
type deviceSet struct {
|
||||
|
@ -2,7 +2,6 @@ package data
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestEncryptDecrypt(t *testing.T) {
|
||||
@ -21,54 +20,6 @@ func TestEncryptDecrypt(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseTimeGenerously(t *testing.T) {
|
||||
ts, err := parseTimeGenerously("2006-01-02T15:04:00-08:00")
|
||||
checkError(t, err)
|
||||
if ts.Unix() != 1136243040 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02 T15:04:00 -08:00")
|
||||
checkError(t, err)
|
||||
if ts.Unix() != 1136243040 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02_T15:04:00_-08:00")
|
||||
checkError(t, err)
|
||||
if ts.Unix() != 1136243040 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02T15:04:00")
|
||||
checkError(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 15 || ts.Minute() != 4 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02_T15:04:00")
|
||||
checkError(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 15 || ts.Minute() != 4 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02_15:04:00")
|
||||
checkError(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 15 || ts.Minute() != 4 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02T15:04")
|
||||
checkError(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 15 || ts.Minute() != 4 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02_15:04")
|
||||
checkError(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 15 || ts.Minute() != 4 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02")
|
||||
checkError(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 0 || ts.Minute() != 0 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
}
|
||||
|
||||
func checkError(t *testing.T, err error) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
10
client/lib/goldens/testCustomColumns-query-isAction=true
Normal file
10
client/lib/goldens/testCustomColumns-query-isAction=true
Normal file
@ -0,0 +1,10 @@
|
||||
Exit Code git_remote Command
|
||||
0 https://github.com/ddworken/hishtory hishtory config-set displayed-columns 'Exit Code' git_remote Command
|
||||
0 echo bar
|
||||
0 cd /
|
||||
0 https://github.com/ddworken/hishtory echo foo
|
||||
0 https://github.com/ddworken/hishtory hishtory config-add custom-column git_remote '(git remote -v 2>/dev/null | grep origin 1>/dev/null ) && git remote get-url origin || true'
|
||||
0 echo baz
|
||||
0 cd /
|
||||
0 echo $FOOBAR world
|
||||
0 export FOOBAR='hello'
|
@ -8,12 +8,12 @@ Search Query: > -pipefail
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Exit Code git_remote Command │
|
||||
│─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
|
||||
│ 0 git@github.com:ddworken/hishtory.git source /Users/david/.bashrc │
|
||||
│ 0 git@github.com:ddworken/hishtory.git hishtory config-set displayed-columns 'Exit Code' git_remote Command │
|
||||
│ 0 https://github.com/ddworken/hishtory source /Users/david/.bashrc │
|
||||
│ 0 https://github.com/ddworken/hishtory hishtory config-set displayed-columns 'Exit Code' git_remote Command │
|
||||
│ 0 echo bar │
|
||||
│ 0 cd / │
|
||||
│ 0 git@github.com:ddworken/hishtory.git echo foo │
|
||||
│ 0 git@github.com:ddworken/hishtory.git hishtory config-add custom-column git_remote '(git remote -v 2>/dev/null | grep origin 1>/dev/null ) && git remote get-url origin || … │
|
||||
│ 0 https://github.com/ddworken/hishtory echo foo │
|
||||
│ 0 https://github.com/ddworken/hishtory hishtory config-add custom-column git_remote '(git remote -v 2>/dev/null | grep origin 1>/dev/null ) && git remote get-url origin || … │
|
||||
│ 0 echo baz │
|
||||
│ 0 cd / │
|
||||
│ 0 echo $FOOBAR world │
|
@ -0,0 +1 @@
|
||||
TODOOOOOOOOO
|
@ -356,3 +356,51 @@ func TestZshWeirdness(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseTimeGenerously(t *testing.T) {
|
||||
ts, err := parseTimeGenerously("2006-01-02T15:04:00-08:00")
|
||||
testutils.Check(t, err)
|
||||
if ts.Unix() != 1136243040 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02 T15:04:00 -08:00")
|
||||
testutils.Check(t, err)
|
||||
if ts.Unix() != 1136243040 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02_T15:04:00_-08:00")
|
||||
testutils.Check(t, err)
|
||||
if ts.Unix() != 1136243040 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02T15:04:00")
|
||||
testutils.Check(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 15 || ts.Minute() != 4 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02_T15:04:00")
|
||||
testutils.Check(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 15 || ts.Minute() != 4 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02_15:04:00")
|
||||
testutils.Check(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 15 || ts.Minute() != 4 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02T15:04")
|
||||
testutils.Check(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 15 || ts.Minute() != 4 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02_15:04")
|
||||
testutils.Check(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 15 || ts.Minute() != 4 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
ts, err = parseTimeGenerously("2006-01-02")
|
||||
testutils.Check(t, err)
|
||||
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 0 || ts.Minute() != 0 || ts.Second() != 0 {
|
||||
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user