mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-22 16:24:00 +01:00
fix hardcoded username in tests + another attempt at enabling bash job control + test that building docker containers works
This commit is contained in:
parent
3619bd5447
commit
e9d19eb782
8
.github/workflows/go-test.yml
vendored
8
.github/workflows/go-test.yml
vendored
@ -5,15 +5,15 @@ on:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
- name: Test
|
||||
- name: Go test
|
||||
run: make test
|
||||
- name: Build docker contains
|
||||
run: make build-api build-static
|
||||
|
@ -151,7 +151,7 @@ func TestIntegrationWithNewDevice(t *testing.T) {
|
||||
// Finally, test the export command
|
||||
out = RunInteractiveBashCommands(t, `hishtory export`)
|
||||
if out != fmt.Sprintf(
|
||||
"/tmp/client install\nset -emo pipefail\nset -emo pipefail\nhishtory status\nset -emo pipefail\nhishtory query\nhishtory query\nls /a\nls /bar\nls /foo\necho foo\necho bar\nhishtory enable\necho thisisrecorded\nset -emo pipefail\nhishtory query\nset -emo pipefail\nhishtory query foo\n/tmp/client install %s\nset -emo pipefail\nhishtory query\nset -emo pipefail\necho mynewcommand\nset -emo pipefail\nhishtory query\nhishtory init %s\nset -emo pipefail\nhishtory query\nset -emo pipefail\necho mynewercommand\nset -emo pipefail\nhishtory query\nothercomputer\nset -emo pipefail\nhishtory query\nset -emo pipefail\n", userSecret, userSecret) {
|
||||
"/tmp/client install\nset -emo pipefail\nset -emo pipefail\nhishtory status\nset -emo pipefail\nhishtory query\nhishtory query\nset -m\nls /a\nls /bar\nls /foo\necho foo\necho bar\nhishtory enable\necho thisisrecorded\nset -emo pipefail\nhishtory query\nset -emo pipefail\nhishtory query foo\n/tmp/client install %s\nset -emo pipefail\nhishtory query\nset -emo pipefail\necho mynewcommand\nset -emo pipefail\nhishtory query\nhishtory init %s\nset -emo pipefail\nhishtory query\nset -emo pipefail\necho mynewercommand\nset -emo pipefail\nhishtory query\nothercomputer\nset -emo pipefail\nhishtory query\nset -emo pipefail\n", userSecret, userSecret) {
|
||||
t.Fatalf("hishtory export had unexpected output! out=%#v", out)
|
||||
}
|
||||
}
|
||||
@ -190,6 +190,7 @@ func testIntegration(t *testing.T) string {
|
||||
|
||||
// Test recording commands
|
||||
out, err := RunInteractiveBashCommandsWithoutStrictMode(t, `
|
||||
set -m
|
||||
ls /a
|
||||
ls /bar
|
||||
ls /foo
|
||||
@ -252,6 +253,7 @@ func TestAdvancedQuery(t *testing.T) {
|
||||
|
||||
// Run some commands we can query for
|
||||
_, _ = RunInteractiveBashCommandsWithoutStrictMode(t, `
|
||||
set -m
|
||||
echo nevershouldappear
|
||||
notacommand
|
||||
cd /tmp/
|
||||
|
@ -2,6 +2,7 @@ package lib
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
"strings"
|
||||
"testing"
|
||||
@ -39,7 +40,11 @@ func TestBuildHistoryEntry(t *testing.T) {
|
||||
if entry.ExitCode != 120 {
|
||||
t.Fatalf("history entry has unexpected exit code: %v", entry.ExitCode)
|
||||
}
|
||||
if entry.LocalUsername != "david" {
|
||||
user, err := user.Current()
|
||||
if err != nil {
|
||||
t.Fatalf("failed to retrieve user: %v", err)
|
||||
}
|
||||
if entry.LocalUsername != user.Username {
|
||||
t.Fatalf("history entry has unexpected user name: %v", entry.LocalUsername)
|
||||
}
|
||||
if !strings.HasPrefix(entry.CurrentWorkingDirectory, "/") && !strings.HasPrefix(entry.CurrentWorkingDirectory, "~/") {
|
||||
|
Loading…
Reference in New Issue
Block a user