From c1918d9ad0174709cbdf6a6acd442abb748edd87 Mon Sep 17 00:00:00 2001 From: Gabriele Belluardo Date: Wed, 15 Jul 2026 12:46:14 +0200 Subject: [PATCH] refactor(test): rename test with conherent naming conventions --- cmd/tpmctl/cmd/add_test.go | 10 +++---- cmd/tpmctl/cmd/check_test.go | 4 +-- cmd/tpmctl/cmd/create_test.go | 2 +- cmd/tpmctl/cmd/mount_test.go | 24 +++++++-------- cmd/tpmctl/cmd/remove_test.go | 4 +-- cmd/tpmctl/cmd/replace_test.go | 6 ++-- .../GET/v2/changes/11 | 0 .../GET/v2/notices | 0 .../GET/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../GET/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../GET/v2/system-volumes | 0 .../GET/v2/changes/670 | 0 .../GET/v2/notices | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../GET/v2/changes/11 | 0 .../GET/v2/notices | 0 .../GET/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../GET/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../GET/v2/system-volumes | 0 .../GET/v2/changes/670 | 0 .../GET/v2/notices | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../GET/v2/changes/305 | 0 .../GET/v2/notices | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 ...y_key => Success_on_creating_recovery_key} | 0 cmd/tpmctl/integrationtests/add_test.go | 8 ++--- cmd/tpmctl/integrationtests/check_test.go | 2 +- cmd/tpmctl/integrationtests/create_test.go | 2 +- cmd/tpmctl/integrationtests/mount_test.go | 19 ++++++------ cmd/tpmctl/integrationtests/remove_test.go | 4 +-- cmd/tpmctl/integrationtests/replace_test.go | 4 +-- .../GET/v2/changes/11 | 0 .../GET/v2/notices | 0 .../GET/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../GET/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../GET/v2/system-volumes | 0 .../GET/v2/changes/670 | 0 .../GET/v2/notices | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../GET/v2/changes/11 | 0 .../GET/v2/notices | 0 .../GET/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../GET/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../GET/v2/system-volumes | 0 .../GET/v2/changes/670 | 0 .../GET/v2/notices | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../GET/v2/changes/305 | 0 .../GET/v2/notices | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 ...y_key => Success_on_creating_recovery_key} | 0 cmd/tpmctl/main_test.go | 4 +-- internal/tpm/auth_test.go | 12 ++++---- internal/tpm/mount_test.go | 30 +++++++++---------- internal/tpm/recovery_test.go | 12 ++++---- .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes:1 | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 .../POST/v2/system-volumes | 0 113 files changed, 74 insertions(+), 73 deletions(-) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_on_adding => Error_on_adding}/GET/v2/changes/11 (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_on_adding => Error_on_adding}/GET/v2/notices (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_on_adding => Error_on_adding}/GET/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_on_adding => Error_on_adding}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_on_adding => Error_on_adding}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_on_validating => Error_on_validating}/GET/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_on_validating => Error_on_validating}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_reading_input => Error_reading_input}/GET/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/GET/v2/changes/670 (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/GET/v2/notices (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_on_adding => Error_on_adding}/GET/v2/changes/11 (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_on_adding => Error_on_adding}/GET/v2/notices (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_on_adding => Error_on_adding}/GET/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_on_adding => Error_on_adding}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_on_adding => Error_on_adding}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_on_validating => Error_on_validating}/GET/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_on_validating => Error_on_validating}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_reading_input => Error_reading_input}/GET/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/GET/v2/changes/670 (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/GET/v2/notices (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestAdd/add-pin/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/cmd/testdata/TestCheck/{Fail_checking_recovery_key => Error_checking_recovery_key}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestCreateKey/{Error_on_empty_name => Error_from_snapd_on_empty_name}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestCreateKey/{Error_on_empty_name => Error_from_snapd_on_empty_name}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/cmd/testdata/TestCreateKey/{Error_on_unique_name => Error_from_snapd_on_unique_name}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestCreateKey/{Error_on_unique_name => Error_from_snapd_on_unique_name}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/cmd/testdata/TestCreateKey/{Success_on_creting_recovery_key => Success_on_creating_recovery_key}/GET/v2/changes/305 (100%) rename cmd/tpmctl/cmd/testdata/TestCreateKey/{Success_on_creting_recovery_key => Success_on_creating_recovery_key}/GET/v2/notices (100%) rename cmd/tpmctl/cmd/testdata/TestCreateKey/{Success_on_creting_recovery_key => Success_on_creating_recovery_key}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestCreateKey/{Success_on_creting_recovery_key => Success_on_creating_recovery_key}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/cmd/testdata/TestRemove/remove-passphrase/{Fail_on_removing => Error_on_removing}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestRemove/remove-pin/{Fail_on_removing => Error_on_removing}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/{Fail_on_replacing => Error_on_replacing}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/{Fail_on_replacing => Error_on_replacing}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/{Fail_on_validating => Error_on_validating}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/{Fail_on_replacing => Error_on_replacing}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/{Fail_on_replacing => Error_on_replacing}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/{Fail_on_validating => Error_on_validating}/POST/v2/system-volumes (100%) rename cmd/tpmctl/cmd/testdata/golden/TestCreateKey/{Success_on_creting_recovery_key => Success_on_creating_recovery_key} (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_on_adding => Error_on_adding}/GET/v2/changes/11 (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_on_adding => Error_on_adding}/GET/v2/notices (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_on_adding => Error_on_adding}/GET/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_on_adding => Error_on_adding}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_on_adding => Error_on_adding}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_on_validating => Error_on_validating}/GET/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_on_validating => Error_on_validating}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_reading_input => Error_reading_input}/GET/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/GET/v2/changes/670 (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/GET/v2/notices (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_on_adding => Error_on_adding}/GET/v2/changes/11 (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_on_adding => Error_on_adding}/GET/v2/notices (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_on_adding => Error_on_adding}/GET/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_on_adding => Error_on_adding}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_on_adding => Error_on_adding}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_on_validating => Error_on_validating}/GET/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_on_validating => Error_on_validating}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_reading_input => Error_reading_input}/GET/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/GET/v2/changes/670 (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/GET/v2/notices (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/{Fail_wrong_auth_mode => Error_wrong_auth_mode}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/integrationtests/testdata/TestCheck/{Fail_checking_recovery_key => Error_checking_recovery_key}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestCreateKey/{Error_on_empty_name => Error_from_snapd_on_empty_name}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestCreateKey/{Error_on_empty_name => Error_from_snapd_on_empty_name}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/integrationtests/testdata/TestCreateKey/{Error_on_unique_name => Error_from_snapd_on_unique_name}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestCreateKey/{Error_on_unique_name => Error_from_snapd_on_unique_name}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/integrationtests/testdata/TestCreateKey/{Success_on_creting_recovery_key => Success_on_creating_recovery_key}/GET/v2/changes/305 (100%) rename cmd/tpmctl/integrationtests/testdata/TestCreateKey/{Success_on_creting_recovery_key => Success_on_creating_recovery_key}/GET/v2/notices (100%) rename cmd/tpmctl/integrationtests/testdata/TestCreateKey/{Success_on_creting_recovery_key => Success_on_creating_recovery_key}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestCreateKey/{Success_on_creting_recovery_key => Success_on_creating_recovery_key}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/integrationtests/testdata/TestRemove/remove-passphrase/{Fail_on_removing => Error_on_removing}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestRemove/remove-pin/{Fail_on_removing => Error_on_removing}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/{Fail_on_replacing => Error_on_replacing}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/{Fail_on_replacing => Error_on_replacing}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/{Fail_on_validating => Error_on_validating}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/{Fail_on_replacing => Error_on_replacing}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/{Fail_on_replacing => Error_on_replacing}/POST/v2/system-volumes:1 (100%) rename cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/{Fail_on_validating => Error_on_validating}/POST/v2/system-volumes (100%) rename cmd/tpmctl/integrationtests/testdata/golden/TestCreateKey/{Success_on_creting_recovery_key => Success_on_creating_recovery_key} (100%) rename internal/tpm/testdata/TestAddPIN/{Fail_adding_pin => Error_adding_pin}/POST/v2/system-volumes (100%) rename internal/tpm/testdata/TestAddPassphrase/{Fail_adding_passphrase => Error_adding_passphrase}/POST/v2/system-volumes (100%) rename internal/tpm/testdata/TestCheckKey/{Fail_checking_recovery_key => Error_checking_recovery_key}/POST/v2/system-volumes (100%) rename internal/tpm/testdata/TestCreateKey/{Fail_adding_recovery_key => Error_adding_recovery_key}/POST/v2/system-volumes (100%) rename internal/tpm/testdata/TestCreateKey/{Fail_adding_recovery_key => Error_adding_recovery_key}/POST/v2/system-volumes:1 (100%) rename internal/tpm/testdata/TestCreateKey/{Fail_generating_recovery_key => Error_generating_recovery_key}/POST/v2/system-volumes (100%) rename internal/tpm/testdata/TestRegenerateKey/{Fail_adding_recovery_key => Error_adding_recovery_key}/POST/v2/system-volumes (100%) rename internal/tpm/testdata/TestRegenerateKey/{Fail_adding_recovery_key => Error_adding_recovery_key}/POST/v2/system-volumes:1 (100%) rename internal/tpm/testdata/TestRegenerateKey/{Fail_generating_recovery_key => Error_generating_recovery_key}/POST/v2/system-volumes (100%) rename internal/tpm/testdata/TestRemovePIN/{Fail_removing_pin => Error_removing_pin}/POST/v2/system-volumes (100%) rename internal/tpm/testdata/TestRemovePassphrase/{Fail_removing_passphrase => Error_removing_passphrase}/POST/v2/system-volumes (100%) rename internal/tpm/testdata/TestReplacePIN/{Fail_replacing_pin => Error_replacing_pin}/POST/v2/system-volumes (100%) rename internal/tpm/testdata/TestReplacePassphrase/{Fail_replacing_passphrase => Error_replacing_passphrase}/POST/v2/system-volumes (100%) diff --git a/cmd/tpmctl/cmd/add_test.go b/cmd/tpmctl/cmd/add_test.go index c7f5c81..fde827d 100644 --- a/cmd/tpmctl/cmd/add_test.go +++ b/cmd/tpmctl/cmd/add_test.go @@ -34,11 +34,11 @@ func TestAdd(t *testing.T) { }{ "Success": {}, - "Fail_on_user_privilege": {admineUID: 1, wantErr: true}, - "Fail_reading_input": {ttyReadError: true, wantErr: true}, - "Fail_wrong_auth_mode": {wantErr: true}, - "Fail_on_validating": {wantErr: true}, - "Fail_on_adding": {wantErr: true}, + "Error_on_user_privilege": {admineUID: 1, wantErr: true}, + "Error_reading_input": {ttyReadError: true, wantErr: true}, + "Error_wrong_auth_mode": {wantErr: true}, + "Error_on_validating": {wantErr: true}, + "Error_on_adding": {wantErr: true}, } for _, command := range commands { for name, tc := range tests { diff --git a/cmd/tpmctl/cmd/check_test.go b/cmd/tpmctl/cmd/check_test.go index 3f69fbb..4b24046 100644 --- a/cmd/tpmctl/cmd/check_test.go +++ b/cmd/tpmctl/cmd/check_test.go @@ -30,8 +30,8 @@ func TestCheck(t *testing.T) { "Success_even_with_invalid_recovery_key": {}, "Success_even_with_incorrect_recovery_key": {key: "incorrect"}, - "Fail_reading_input": {ttyReadError: true, wantErr: true}, - "Fail_checking_recovery_key": {wantErr: true}, + "Error_reading_input": {ttyReadError: true, wantErr: true}, + "Error_checking_recovery_key": {wantErr: true}, } for name, tc := range tests { diff --git a/cmd/tpmctl/cmd/create_test.go b/cmd/tpmctl/cmd/create_test.go index bcaf3cf..1998af6 100644 --- a/cmd/tpmctl/cmd/create_test.go +++ b/cmd/tpmctl/cmd/create_test.go @@ -24,7 +24,7 @@ func TestCreateKey(t *testing.T) { wantErr bool }{ - "Success_on_creting_recovery_key": {}, + "Success_on_creating_recovery_key": {}, "Error_from_snapd_on_empty_name": {wantErr: true}, "Error_from_snapd_on_unique_name": {recoveryKeyName: "test-duplicate", wantErr: true}, diff --git a/cmd/tpmctl/cmd/mount_test.go b/cmd/tpmctl/cmd/mount_test.go index 6da4720..fa5e052 100644 --- a/cmd/tpmctl/cmd/mount_test.go +++ b/cmd/tpmctl/cmd/mount_test.go @@ -36,13 +36,13 @@ func TestMountVolume(t *testing.T) { }{ "Success on mounting volume": {}, - "Error out when authRequestor fails": {ttyReadError: true, wantErr: true}, - "Error out when mount fails": {syscall: tpmtestutils.TestSyscall{WantErr: true}, wantErr: true}, - "Error out when volume is already mounted": {alreadyMountedErr: true, wantErr: true}, - "Error out when device doesn't exists": {deviceStatError: true, wantErr: true}, - "Error out when device is empty": {emptyDeviceError: true, wantErr: true}, - "Error out when dir path is empty": {emptyDirError: true, wantErr: true}, - "Error out when device is already in use by another tool": {deviceInUse: true, wantErr: true}, + "Error_when_authRequestor_fails": {ttyReadError: true, wantErr: true}, + "Error_when_mount_fails": {syscall: tpmtestutils.TestSyscall{WantErr: true}, wantErr: true}, + "Error_when_volume_is_already_mounted": {alreadyMountedErr: true, wantErr: true}, + "Error_when_device_does_not_exist": {deviceStatError: true, wantErr: true}, + "Error_when_device_is_empty": {emptyDeviceError: true, wantErr: true}, + "Error_when_dir_path_is_empty": {emptyDirError: true, wantErr: true}, + "Error_when_device_is_already_in_use_by_another_tool": {deviceInUse: true, wantErr: true}, } for name, tc := range tests { @@ -142,8 +142,8 @@ func TestUnmountVolume(t *testing.T) { }{ "Success on unmounting volume": {}, - "Error out when unmount fails": {syscall: tpmtestutils.TestSyscall{WantErr: true}, wantErr: true}, - "Error out when dir path is empty": {emptyDirError: true, wantErr: true}, + "Error_when_unmount_fails": {syscall: tpmtestutils.TestSyscall{WantErr: true}, wantErr: true}, + "Error_when_dir_path_is_empty": {emptyDirError: true, wantErr: true}, } for name, tc := range tests { @@ -209,9 +209,9 @@ func TestGetLuksKeyFromRecoveryKey(t *testing.T) { "Success_getting_luks_key_with_hex_flag": {hexFlag: true}, "Success_getting_luks_key_with_escaped_flag": {escapedFlag: true}, - "Fail_reading_input": {ttyReadError: true, wantErr: true}, - "Fail_getting_luks_key": {recoveryKey: "invalid", wantErr: true}, - "Fail_for_too_many_flags": {wantErr: true, hexFlag: true, escapedFlag: true}, + "Error_reading_input": {ttyReadError: true, wantErr: true}, + "Error_getting_luks_key": {recoveryKey: "invalid", wantErr: true}, + "Error_for_too_many_flags": {wantErr: true, hexFlag: true, escapedFlag: true}, } for name, tc := range tests { diff --git a/cmd/tpmctl/cmd/remove_test.go b/cmd/tpmctl/cmd/remove_test.go index 47ac85c..d590c1f 100644 --- a/cmd/tpmctl/cmd/remove_test.go +++ b/cmd/tpmctl/cmd/remove_test.go @@ -31,8 +31,8 @@ func TestRemove(t *testing.T) { }{ "Success_on_removing": {}, - "Fail_on_user_privilege": {admineUID: 1, wantErr: true}, - "Fail_on_removing": {wantErr: true}, + "Error_on_user_privilege": {admineUID: 1, wantErr: true}, + "Error_on_removing": {wantErr: true}, } for _, command := range commands { for name, tc := range tests { diff --git a/cmd/tpmctl/cmd/replace_test.go b/cmd/tpmctl/cmd/replace_test.go index 37dc6cd..5627d3e 100644 --- a/cmd/tpmctl/cmd/replace_test.go +++ b/cmd/tpmctl/cmd/replace_test.go @@ -33,9 +33,9 @@ func TestReplace(t *testing.T) { }{ "Success_on_replacing": {}, - "Fail_reading_input": {ttyReadError: true, wantErr: true}, - "Fail_on_validating": {wantErr: true}, - "Fail_on_replacing": {wantErr: true}, + "Error_reading_input": {ttyReadError: true, wantErr: true}, + "Error_on_validating": {wantErr: true}, + "Error_on_replacing": {wantErr: true}, } for _, command := range commands { diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/changes/11 b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/changes/11 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/changes/11 rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/changes/11 diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/notices b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/notices similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/notices rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/notices diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_adding/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_adding/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_adding/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_adding/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_adding/POST/v2/system-volumes:1 b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_adding/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_adding/POST/v2/system-volumes:1 rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_adding/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_validating/GET/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_validating/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_validating/GET/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_validating/GET/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_validating/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_validating/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_on_validating/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_on_validating/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_reading_input/GET/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_reading_input/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_reading_input/GET/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_reading_input/GET/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/GET/v2/changes/670 b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/GET/v2/changes/670 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/GET/v2/changes/670 rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/GET/v2/changes/670 diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/GET/v2/notices b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/GET/v2/notices similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/GET/v2/notices rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/GET/v2/notices diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/POST/v2/system-volumes:1 b/cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/POST/v2/system-volumes:1 rename to cmd/tpmctl/cmd/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/changes/11 b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/changes/11 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/changes/11 rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/changes/11 diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/notices b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/notices similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/notices rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/notices diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_adding/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_adding/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_adding/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_adding/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_adding/POST/v2/system-volumes:1 b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_adding/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_adding/POST/v2/system-volumes:1 rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_adding/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_validating/GET/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_validating/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_validating/GET/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_validating/GET/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_validating/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_validating/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_on_validating/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_on_validating/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_reading_input/GET/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_reading_input/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_reading_input/GET/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_reading_input/GET/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/GET/v2/changes/670 b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_wrong_auth_mode/GET/v2/changes/670 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/GET/v2/changes/670 rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_wrong_auth_mode/GET/v2/changes/670 diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/GET/v2/notices b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_wrong_auth_mode/GET/v2/notices similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/GET/v2/notices rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_wrong_auth_mode/GET/v2/notices diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_wrong_auth_mode/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_wrong_auth_mode/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/POST/v2/system-volumes:1 b/cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_wrong_auth_mode/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/POST/v2/system-volumes:1 rename to cmd/tpmctl/cmd/testdata/TestAdd/add-pin/Error_wrong_auth_mode/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/cmd/testdata/TestCheck/Fail_checking_recovery_key/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestCheck/Error_checking_recovery_key/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestCheck/Fail_checking_recovery_key/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestCheck/Error_checking_recovery_key/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestCreateKey/Error_on_empty_name/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestCreateKey/Error_from_snapd_on_empty_name/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestCreateKey/Error_on_empty_name/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestCreateKey/Error_from_snapd_on_empty_name/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestCreateKey/Error_on_empty_name/POST/v2/system-volumes:1 b/cmd/tpmctl/cmd/testdata/TestCreateKey/Error_from_snapd_on_empty_name/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestCreateKey/Error_on_empty_name/POST/v2/system-volumes:1 rename to cmd/tpmctl/cmd/testdata/TestCreateKey/Error_from_snapd_on_empty_name/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/cmd/testdata/TestCreateKey/Error_on_unique_name/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestCreateKey/Error_from_snapd_on_unique_name/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestCreateKey/Error_on_unique_name/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestCreateKey/Error_from_snapd_on_unique_name/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestCreateKey/Error_on_unique_name/POST/v2/system-volumes:1 b/cmd/tpmctl/cmd/testdata/TestCreateKey/Error_from_snapd_on_unique_name/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestCreateKey/Error_on_unique_name/POST/v2/system-volumes:1 rename to cmd/tpmctl/cmd/testdata/TestCreateKey/Error_from_snapd_on_unique_name/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creting_recovery_key/GET/v2/changes/305 b/cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creating_recovery_key/GET/v2/changes/305 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creting_recovery_key/GET/v2/changes/305 rename to cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creating_recovery_key/GET/v2/changes/305 diff --git a/cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creting_recovery_key/GET/v2/notices b/cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creating_recovery_key/GET/v2/notices similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creting_recovery_key/GET/v2/notices rename to cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creating_recovery_key/GET/v2/notices diff --git a/cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creting_recovery_key/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creating_recovery_key/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creting_recovery_key/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creating_recovery_key/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creting_recovery_key/POST/v2/system-volumes:1 b/cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creating_recovery_key/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creting_recovery_key/POST/v2/system-volumes:1 rename to cmd/tpmctl/cmd/testdata/TestCreateKey/Success_on_creating_recovery_key/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/cmd/testdata/TestRemove/remove-passphrase/Fail_on_removing/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestRemove/remove-passphrase/Error_on_removing/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestRemove/remove-passphrase/Fail_on_removing/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestRemove/remove-passphrase/Error_on_removing/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestRemove/remove-pin/Fail_on_removing/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestRemove/remove-pin/Error_on_removing/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestRemove/remove-pin/Fail_on_removing/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestRemove/remove-pin/Error_on_removing/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Fail_on_replacing/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Error_on_replacing/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Fail_on_replacing/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Error_on_replacing/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Fail_on_replacing/POST/v2/system-volumes:1 b/cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Error_on_replacing/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Fail_on_replacing/POST/v2/system-volumes:1 rename to cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Error_on_replacing/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Fail_on_validating/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Error_on_validating/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Fail_on_validating/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestReplace/replace-passphrase/Error_on_validating/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Fail_on_replacing/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Error_on_replacing/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Fail_on_replacing/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Error_on_replacing/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Fail_on_replacing/POST/v2/system-volumes:1 b/cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Error_on_replacing/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Fail_on_replacing/POST/v2/system-volumes:1 rename to cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Error_on_replacing/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Fail_on_validating/POST/v2/system-volumes b/cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Error_on_validating/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Fail_on_validating/POST/v2/system-volumes rename to cmd/tpmctl/cmd/testdata/TestReplace/replace-pin/Error_on_validating/POST/v2/system-volumes diff --git a/cmd/tpmctl/cmd/testdata/golden/TestCreateKey/Success_on_creting_recovery_key b/cmd/tpmctl/cmd/testdata/golden/TestCreateKey/Success_on_creating_recovery_key similarity index 100% rename from cmd/tpmctl/cmd/testdata/golden/TestCreateKey/Success_on_creting_recovery_key rename to cmd/tpmctl/cmd/testdata/golden/TestCreateKey/Success_on_creating_recovery_key diff --git a/cmd/tpmctl/integrationtests/add_test.go b/cmd/tpmctl/integrationtests/add_test.go index ab1935f..7f321ad 100644 --- a/cmd/tpmctl/integrationtests/add_test.go +++ b/cmd/tpmctl/integrationtests/add_test.go @@ -27,10 +27,10 @@ func TestAdd(t *testing.T) { }{ "Success": {}, - "Fail_on_user_privilege": {nonRootUser: true, wantErr: true}, - "Fail_wrong_auth_mode": {wantErr: true}, - "Fail_on_validating": {wantErr: true}, - "Fail_on_adding": {wantErr: true}, + "Error_on_user_privilege": {nonRootUser: true, wantErr: true}, + "Error_wrong_auth_mode": {wantErr: true}, + "Error_on_validating": {wantErr: true}, + "Error_on_adding": {wantErr: true}, } for _, command := range commands { for name, tc := range tests { diff --git a/cmd/tpmctl/integrationtests/check_test.go b/cmd/tpmctl/integrationtests/check_test.go index 92c8b6d..b5aaf72 100644 --- a/cmd/tpmctl/integrationtests/check_test.go +++ b/cmd/tpmctl/integrationtests/check_test.go @@ -24,7 +24,7 @@ func TestCheck(t *testing.T) { "Success_even_with_invalid_recovery_key": {}, "Success_even_with_incorrect_recovery_key": {key: "incorrect"}, - "Fail_checking_recovery_key": {wantErr: true}, + "Error_checking_recovery_key": {wantErr: true}, } for name, tc := range tests { diff --git a/cmd/tpmctl/integrationtests/create_test.go b/cmd/tpmctl/integrationtests/create_test.go index 7094d27..aedfeea 100644 --- a/cmd/tpmctl/integrationtests/create_test.go +++ b/cmd/tpmctl/integrationtests/create_test.go @@ -18,7 +18,7 @@ func TestCreateKey(t *testing.T) { wantErr bool }{ - "Success_on_creting_recovery_key": {}, + "Success_on_creating_recovery_key": {}, "Error_from_snapd_on_empty_name": {wantErr: true}, "Error_from_snapd_on_unique_name": {recoveryKeyName: "test-duplicate", wantErr: true}, diff --git a/cmd/tpmctl/integrationtests/mount_test.go b/cmd/tpmctl/integrationtests/mount_test.go index 21aebf6..2d29c05 100644 --- a/cmd/tpmctl/integrationtests/mount_test.go +++ b/cmd/tpmctl/integrationtests/mount_test.go @@ -31,11 +31,12 @@ func TestMountVolume(t *testing.T) { }{ "Success on mounting volume": {}, - "Error out when mount fails": {mountErr: true, wantErr: true}, - "Error out when volume is already mounted": {alreadyMountedErr: true, wantErr: true}, - "Error out when device doesn't exists": {deviceStatError: true, wantErr: true}, - "Error out when device is empty": {emptyDeviceError: true, wantErr: true}, - "Error out when dir path is empty": {emptyDirError: true, wantErr: true}, "Error out when device is already in use by another tool": {deviceInUse: true, wantErr: true}, + "Error_when_mount_fails": {mountErr: true, wantErr: true}, + "Error_when_volume_is_already_mounted": {alreadyMountedErr: true, wantErr: true}, + "Error_when_device_does_not_exist": {deviceStatError: true, wantErr: true}, + "Error_when_device_is_empty": {emptyDeviceError: true, wantErr: true}, + "Error_when_dir_path_is_empty": {emptyDirError: true, wantErr: true}, + "Error_when_device_is_already_in_use_by_another_tool": {deviceInUse: true, wantErr: true}, } for name, tc := range tests { @@ -119,8 +120,8 @@ func TestUnmountVolume(t *testing.T) { }{ "Success on unmounting volume": {}, - "Error out when unmount fails": {unmountErr: true, wantErr: true}, - "Error out when dir path is empty": {emptyDirError: true, wantErr: true}, + "Error_when_unmount_fails": {unmountErr: true, wantErr: true}, + "Error_when_dir_path_is_empty": {emptyDirError: true, wantErr: true}, } for name, tc := range tests { @@ -173,8 +174,8 @@ func TestGetLuksKeyFromRecoveryKey(t *testing.T) { "Success_getting_luks_key_with_hex_flag": {hexFlag: true}, "Success_getting_luks_key_with_escaped_flag": {escapedFlag: true}, - "Fail_getting_luks_key": {recoveryKey: "invalid", wantErr: true}, - "Fail_for_too_many_flags": {wantErr: true, hexFlag: true, escapedFlag: true}, + "Error_getting_luks_key": {recoveryKey: "invalid", wantErr: true}, + "Error_for_too_many_flags": {wantErr: true, hexFlag: true, escapedFlag: true}, } for name, tc := range tests { diff --git a/cmd/tpmctl/integrationtests/remove_test.go b/cmd/tpmctl/integrationtests/remove_test.go index e9361f9..475d706 100644 --- a/cmd/tpmctl/integrationtests/remove_test.go +++ b/cmd/tpmctl/integrationtests/remove_test.go @@ -25,8 +25,8 @@ func TestRemove(t *testing.T) { }{ "Success_on_removing": {}, - "Fail_on_user_privilege": {nonRootUser: true, wantErr: true}, - "Fail_on_removing": {wantErr: true}, + "Error_on_user_privilege": {nonRootUser: true, wantErr: true}, + "Error_on_removing": {wantErr: true}, } for _, command := range commands { for name, tc := range tests { diff --git a/cmd/tpmctl/integrationtests/replace_test.go b/cmd/tpmctl/integrationtests/replace_test.go index fc841f8..566d3b5 100644 --- a/cmd/tpmctl/integrationtests/replace_test.go +++ b/cmd/tpmctl/integrationtests/replace_test.go @@ -25,8 +25,8 @@ func TestReplace(t *testing.T) { }{ "Success_on_replacing": {}, - "Fail_on_validating": {wantErr: true}, - "Fail_on_replacing": {wantErr: true}, + "Error_on_validating": {wantErr: true}, + "Error_on_replacing": {wantErr: true}, } for _, command := range commands { diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/changes/11 b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/changes/11 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/changes/11 rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/changes/11 diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/notices b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/notices similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/notices rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/notices diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_adding/GET/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_adding/GET/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_adding/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_adding/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_adding/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_adding/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_adding/POST/v2/system-volumes:1 b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_adding/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_adding/POST/v2/system-volumes:1 rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_adding/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_validating/GET/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_validating/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_validating/GET/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_validating/GET/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_validating/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_validating/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_on_validating/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_on_validating/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_reading_input/GET/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_reading_input/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_reading_input/GET/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_reading_input/GET/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/GET/v2/changes/670 b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/GET/v2/changes/670 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/GET/v2/changes/670 rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/GET/v2/changes/670 diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/GET/v2/notices b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/GET/v2/notices similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/GET/v2/notices rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/GET/v2/notices diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/POST/v2/system-volumes:1 b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Fail_wrong_auth_mode/POST/v2/system-volumes:1 rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-passphrase/Error_wrong_auth_mode/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/changes/11 b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/changes/11 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/changes/11 rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/changes/11 diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/notices b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/notices similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/notices rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/notices diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_adding/GET/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_adding/GET/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_adding/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_adding/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_adding/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_adding/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_adding/POST/v2/system-volumes:1 b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_adding/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_adding/POST/v2/system-volumes:1 rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_adding/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_validating/GET/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_validating/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_validating/GET/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_validating/GET/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_validating/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_validating/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_on_validating/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_on_validating/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_reading_input/GET/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_reading_input/GET/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_reading_input/GET/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_reading_input/GET/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/GET/v2/changes/670 b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_wrong_auth_mode/GET/v2/changes/670 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/GET/v2/changes/670 rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_wrong_auth_mode/GET/v2/changes/670 diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/GET/v2/notices b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_wrong_auth_mode/GET/v2/notices similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/GET/v2/notices rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_wrong_auth_mode/GET/v2/notices diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_wrong_auth_mode/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_wrong_auth_mode/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/POST/v2/system-volumes:1 b/cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_wrong_auth_mode/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Fail_wrong_auth_mode/POST/v2/system-volumes:1 rename to cmd/tpmctl/integrationtests/testdata/TestAdd/add-pin/Error_wrong_auth_mode/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/integrationtests/testdata/TestCheck/Fail_checking_recovery_key/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestCheck/Error_checking_recovery_key/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestCheck/Fail_checking_recovery_key/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestCheck/Error_checking_recovery_key/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_on_empty_name/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_from_snapd_on_empty_name/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_on_empty_name/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_from_snapd_on_empty_name/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_on_empty_name/POST/v2/system-volumes:1 b/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_from_snapd_on_empty_name/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_on_empty_name/POST/v2/system-volumes:1 rename to cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_from_snapd_on_empty_name/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_on_unique_name/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_from_snapd_on_unique_name/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_on_unique_name/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_from_snapd_on_unique_name/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_on_unique_name/POST/v2/system-volumes:1 b/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_from_snapd_on_unique_name/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_on_unique_name/POST/v2/system-volumes:1 rename to cmd/tpmctl/integrationtests/testdata/TestCreateKey/Error_from_snapd_on_unique_name/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creting_recovery_key/GET/v2/changes/305 b/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creating_recovery_key/GET/v2/changes/305 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creting_recovery_key/GET/v2/changes/305 rename to cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creating_recovery_key/GET/v2/changes/305 diff --git a/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creting_recovery_key/GET/v2/notices b/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creating_recovery_key/GET/v2/notices similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creting_recovery_key/GET/v2/notices rename to cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creating_recovery_key/GET/v2/notices diff --git a/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creting_recovery_key/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creating_recovery_key/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creting_recovery_key/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creating_recovery_key/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creting_recovery_key/POST/v2/system-volumes:1 b/cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creating_recovery_key/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creting_recovery_key/POST/v2/system-volumes:1 rename to cmd/tpmctl/integrationtests/testdata/TestCreateKey/Success_on_creating_recovery_key/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/integrationtests/testdata/TestRemove/remove-passphrase/Fail_on_removing/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestRemove/remove-passphrase/Error_on_removing/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestRemove/remove-passphrase/Fail_on_removing/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestRemove/remove-passphrase/Error_on_removing/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestRemove/remove-pin/Fail_on_removing/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestRemove/remove-pin/Error_on_removing/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestRemove/remove-pin/Fail_on_removing/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestRemove/remove-pin/Error_on_removing/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Fail_on_replacing/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Error_on_replacing/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Fail_on_replacing/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Error_on_replacing/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Fail_on_replacing/POST/v2/system-volumes:1 b/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Error_on_replacing/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Fail_on_replacing/POST/v2/system-volumes:1 rename to cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Error_on_replacing/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Fail_on_validating/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Error_on_validating/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Fail_on_validating/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestReplace/replace-passphrase/Error_on_validating/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Fail_on_replacing/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Error_on_replacing/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Fail_on_replacing/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Error_on_replacing/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Fail_on_replacing/POST/v2/system-volumes:1 b/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Error_on_replacing/POST/v2/system-volumes:1 similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Fail_on_replacing/POST/v2/system-volumes:1 rename to cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Error_on_replacing/POST/v2/system-volumes:1 diff --git a/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Fail_on_validating/POST/v2/system-volumes b/cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Error_on_validating/POST/v2/system-volumes similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Fail_on_validating/POST/v2/system-volumes rename to cmd/tpmctl/integrationtests/testdata/TestReplace/replace-pin/Error_on_validating/POST/v2/system-volumes diff --git a/cmd/tpmctl/integrationtests/testdata/golden/TestCreateKey/Success_on_creting_recovery_key b/cmd/tpmctl/integrationtests/testdata/golden/TestCreateKey/Success_on_creating_recovery_key similarity index 100% rename from cmd/tpmctl/integrationtests/testdata/golden/TestCreateKey/Success_on_creting_recovery_key rename to cmd/tpmctl/integrationtests/testdata/golden/TestCreateKey/Success_on_creating_recovery_key diff --git a/cmd/tpmctl/main_test.go b/cmd/tpmctl/main_test.go index 61e5bc9..1497cee 100644 --- a/cmd/tpmctl/main_test.go +++ b/cmd/tpmctl/main_test.go @@ -25,8 +25,8 @@ func TestRun(t *testing.T) { want int wantInLog string }{ - "Returns 0 on success": {app: mockApp{err: nil}, want: 0}, - "Returns 1 when got an error": {app: mockApp{err: errors.New("desired error")}, want: 1, wantInLog: "desired error"}, + "Returns 0 on success": {app: mockApp{err: nil}, want: 0}, + "Returns 1 on error": {app: mockApp{err: errors.New("desired error")}, want: 1, wantInLog: "desired error"}, } for name, tc := range tests { diff --git a/internal/tpm/auth_test.go b/internal/tpm/auth_test.go index 1937486..dfef67e 100644 --- a/internal/tpm/auth_test.go +++ b/internal/tpm/auth_test.go @@ -21,7 +21,7 @@ func TestAddPassphrase(t *testing.T) { }{ "Success_adding_passphrase": {passphrase: "test"}, - "Fail_adding_passphrase": {wantErr: true}, + "Error_adding_passphrase": {wantErr: true}, } for name, tc := range tests { @@ -54,7 +54,7 @@ func TestReplacePassphrase(t *testing.T) { }{ "Success_replacing_passphrase": {old: "old", new: "new"}, - "Fail_replacing_passphrase": {wantErr: true}, + "Error_replacing_passphrase": {wantErr: true}, } for name, tc := range tests { @@ -84,7 +84,7 @@ func TestRemovePassphrase(t *testing.T) { }{ "Success_removing_passphrase": {}, - "Fail_removing_passphrase": {wantErr: true}, + "Error_removing_passphrase": {wantErr: true}, } for name, tc := range tests { @@ -116,7 +116,7 @@ func TestAddPIN(t *testing.T) { }{ "Success_adding_pin": {pin: "123456"}, - "Fail_adding_pin": {wantErr: true}, + "Error_adding_pin": {wantErr: true}, } for name, tc := range tests { @@ -149,7 +149,7 @@ func TestReplacePIN(t *testing.T) { }{ "Success_replacing_pin": {old: "123456", new: "654321"}, - "Fail_replacing_pin": {wantErr: true}, + "Error_replacing_pin": {wantErr: true}, } for name, tc := range tests { @@ -179,7 +179,7 @@ func TestRemovePIN(t *testing.T) { }{ "Success_removing_pin": {}, - "Fail_removing_pin": {wantErr: true}, + "Error_removing_pin": {wantErr: true}, } for name, tc := range tests { diff --git a/internal/tpm/mount_test.go b/internal/tpm/mount_test.go index 0a070c6..9c6c56a 100644 --- a/internal/tpm/mount_test.go +++ b/internal/tpm/mount_test.go @@ -43,14 +43,14 @@ func TestMountVolume(t *testing.T) { wantMounted: true, }, - "Error out when unable to crate directory": {mkdirErr: true, wantErr: true}, - "Error out when authRequestor fails": {authRequestor: authRequestor{wantErr: true}, wantErr: true}, - "Error out when unable to mount volume": {syscall: tpmtestutils.TestSyscall{WantErr: true}, wantRequested: true, wantErr: true}, - "Error out when volume is already mounted": {alreadyMountedErr: true, wantErr: true}, - "Error out when unable to locate volume": {readErr: true, wantErr: true}, - "Error out when systemd-cryptsetup fails": {device: "exit-with-failure", wantRequested: true, wantErr: true}, - "Error out when device is already in use by another tool": {deviceInUse: true, wantErr: true}, - "Error out when device is cannot be located": {deviceInUse: true, classBlockErr: true, wantErr: true}, + "Error when unable to create directory": {mkdirErr: true, wantErr: true}, + "Error when authRequestor fails": {authRequestor: authRequestor{wantErr: true}, wantErr: true}, + "Error when unable to mount volume": {syscall: tpmtestutils.TestSyscall{WantErr: true}, wantRequested: true, wantErr: true}, + "Error when volume is already mounted": {alreadyMountedErr: true, wantErr: true}, + "Error when unable to locate volume": {readErr: true, wantErr: true}, + "Error when systemd cryptsetup fails": {device: "exit-with-failure", wantRequested: true, wantErr: true}, + "Error when device is already in use by another tool": {deviceInUse: true, wantErr: true}, + "Error when device cannot be located": {deviceInUse: true, classBlockErr: true, wantErr: true}, } for name, tc := range tests { @@ -132,11 +132,11 @@ func TestUnmountVolume(t *testing.T) { }{ "Success on unmounting volume": {wantUnmounted: true}, - "Error out when unable to remove directory": {wantRmdirErr: true, wantErr: true}, - "Error out when unable determine device path": {readErr: true, wantErr: true}, - "Error out when path is not found": {target: "not-existing-target", wantErr: true}, - "Error out when unable to unmount volume": {syscall: tpmtestutils.TestSyscall{WantErr: true}, wantErr: true}, - "Error out when systemd-cryptsetup fails": {mapper: "exit-with-failure", wantErr: true}, + "Error when unable to remove directory": {wantRmdirErr: true, wantErr: true}, + "Error when unable to determine device path": {readErr: true, wantErr: true}, + "Error when path is not found": {target: "not-existing-target", wantErr: true}, + "Error when unable to unmount volume": {syscall: tpmtestutils.TestSyscall{WantErr: true}, wantErr: true}, + "Error when systemd cryptsetup fails": {mapper: "exit-with-failure", wantErr: true}, } for name, tc := range tests { @@ -218,8 +218,8 @@ func TestSearchInProcMounts(t *testing.T) { "Success on getting mapper": {fieldPath: 0, fieldResult: 1}, "Success with no path found in /proc/mounts": {path: "wrong-path", notFound: true}, - "Fail to open /proc/mounts": {fileErr: true, wantErr: true}, - "Fail to read /proc/mounts": {readErr: true, wantErr: true}, + "Error opening /proc/mounts": {fileErr: true, wantErr: true}, + "Error reading /proc/mounts": {readErr: true, wantErr: true}, } for name, tc := range tests { diff --git a/internal/tpm/recovery_test.go b/internal/tpm/recovery_test.go index af7a697..86cf982 100644 --- a/internal/tpm/recovery_test.go +++ b/internal/tpm/recovery_test.go @@ -23,8 +23,8 @@ func TestCreateKey(t *testing.T) { }{ "Success_creating_recovery_key": {recoveryKeyName: "test", recoveryKey: "11272-47509-28031-54818-41671-38673-11053-06376"}, - "Fail_generating_recovery_key": {wantErr: true}, - "Fail_adding_recovery_key": {wantErr: true}, + "Error_generating_recovery_key": {wantErr: true}, + "Error_adding_recovery_key": {wantErr: true}, } for name, tc := range tests { @@ -59,8 +59,8 @@ func TestRegenerateKey(t *testing.T) { }{ "Success_regenerating_recovery_key": {recoveryKeyName: "test", recoveryKey: "11272-47509-28031-54818-41671-38673-11053-06376"}, - "Fail_generating_recovery_key": {wantErr: true}, - "Fail_adding_recovery_key": {wantErr: true}, + "Error_generating_recovery_key": {wantErr: true}, + "Error_adding_recovery_key": {wantErr: true}, } for name, tc := range tests { @@ -93,7 +93,7 @@ func TestCheckKey(t *testing.T) { }{ "Success_checking_recovery_key": {recoveryKey: "11272-47509-28031-54818-41671-38673-11053-06376"}, - "Fail_checking_recovery_key": {wantErr: true}, + "Error_checking_recovery_key": {wantErr: true}, } for name, tc := range tests { @@ -127,7 +127,7 @@ func TestGetLuksKey(t *testing.T) { }{ "Success_getting_luks_key": {recoveryKey: "11272-47509-28031-54818-41671-38673-11053-06376"}, - "Fail_getting_luks_key": {wantErr: true}, + "Error_getting_luks_key": {wantErr: true}, } for name, tc := range tests { diff --git a/internal/tpm/testdata/TestAddPIN/Fail_adding_pin/POST/v2/system-volumes b/internal/tpm/testdata/TestAddPIN/Error_adding_pin/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestAddPIN/Fail_adding_pin/POST/v2/system-volumes rename to internal/tpm/testdata/TestAddPIN/Error_adding_pin/POST/v2/system-volumes diff --git a/internal/tpm/testdata/TestAddPassphrase/Fail_adding_passphrase/POST/v2/system-volumes b/internal/tpm/testdata/TestAddPassphrase/Error_adding_passphrase/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestAddPassphrase/Fail_adding_passphrase/POST/v2/system-volumes rename to internal/tpm/testdata/TestAddPassphrase/Error_adding_passphrase/POST/v2/system-volumes diff --git a/internal/tpm/testdata/TestCheckKey/Fail_checking_recovery_key/POST/v2/system-volumes b/internal/tpm/testdata/TestCheckKey/Error_checking_recovery_key/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestCheckKey/Fail_checking_recovery_key/POST/v2/system-volumes rename to internal/tpm/testdata/TestCheckKey/Error_checking_recovery_key/POST/v2/system-volumes diff --git a/internal/tpm/testdata/TestCreateKey/Fail_adding_recovery_key/POST/v2/system-volumes b/internal/tpm/testdata/TestCreateKey/Error_adding_recovery_key/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestCreateKey/Fail_adding_recovery_key/POST/v2/system-volumes rename to internal/tpm/testdata/TestCreateKey/Error_adding_recovery_key/POST/v2/system-volumes diff --git a/internal/tpm/testdata/TestCreateKey/Fail_adding_recovery_key/POST/v2/system-volumes:1 b/internal/tpm/testdata/TestCreateKey/Error_adding_recovery_key/POST/v2/system-volumes:1 similarity index 100% rename from internal/tpm/testdata/TestCreateKey/Fail_adding_recovery_key/POST/v2/system-volumes:1 rename to internal/tpm/testdata/TestCreateKey/Error_adding_recovery_key/POST/v2/system-volumes:1 diff --git a/internal/tpm/testdata/TestCreateKey/Fail_generating_recovery_key/POST/v2/system-volumes b/internal/tpm/testdata/TestCreateKey/Error_generating_recovery_key/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestCreateKey/Fail_generating_recovery_key/POST/v2/system-volumes rename to internal/tpm/testdata/TestCreateKey/Error_generating_recovery_key/POST/v2/system-volumes diff --git a/internal/tpm/testdata/TestRegenerateKey/Fail_adding_recovery_key/POST/v2/system-volumes b/internal/tpm/testdata/TestRegenerateKey/Error_adding_recovery_key/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestRegenerateKey/Fail_adding_recovery_key/POST/v2/system-volumes rename to internal/tpm/testdata/TestRegenerateKey/Error_adding_recovery_key/POST/v2/system-volumes diff --git a/internal/tpm/testdata/TestRegenerateKey/Fail_adding_recovery_key/POST/v2/system-volumes:1 b/internal/tpm/testdata/TestRegenerateKey/Error_adding_recovery_key/POST/v2/system-volumes:1 similarity index 100% rename from internal/tpm/testdata/TestRegenerateKey/Fail_adding_recovery_key/POST/v2/system-volumes:1 rename to internal/tpm/testdata/TestRegenerateKey/Error_adding_recovery_key/POST/v2/system-volumes:1 diff --git a/internal/tpm/testdata/TestRegenerateKey/Fail_generating_recovery_key/POST/v2/system-volumes b/internal/tpm/testdata/TestRegenerateKey/Error_generating_recovery_key/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestRegenerateKey/Fail_generating_recovery_key/POST/v2/system-volumes rename to internal/tpm/testdata/TestRegenerateKey/Error_generating_recovery_key/POST/v2/system-volumes diff --git a/internal/tpm/testdata/TestRemovePIN/Fail_removing_pin/POST/v2/system-volumes b/internal/tpm/testdata/TestRemovePIN/Error_removing_pin/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestRemovePIN/Fail_removing_pin/POST/v2/system-volumes rename to internal/tpm/testdata/TestRemovePIN/Error_removing_pin/POST/v2/system-volumes diff --git a/internal/tpm/testdata/TestRemovePassphrase/Fail_removing_passphrase/POST/v2/system-volumes b/internal/tpm/testdata/TestRemovePassphrase/Error_removing_passphrase/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestRemovePassphrase/Fail_removing_passphrase/POST/v2/system-volumes rename to internal/tpm/testdata/TestRemovePassphrase/Error_removing_passphrase/POST/v2/system-volumes diff --git a/internal/tpm/testdata/TestReplacePIN/Fail_replacing_pin/POST/v2/system-volumes b/internal/tpm/testdata/TestReplacePIN/Error_replacing_pin/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestReplacePIN/Fail_replacing_pin/POST/v2/system-volumes rename to internal/tpm/testdata/TestReplacePIN/Error_replacing_pin/POST/v2/system-volumes diff --git a/internal/tpm/testdata/TestReplacePassphrase/Fail_replacing_passphrase/POST/v2/system-volumes b/internal/tpm/testdata/TestReplacePassphrase/Error_replacing_passphrase/POST/v2/system-volumes similarity index 100% rename from internal/tpm/testdata/TestReplacePassphrase/Fail_replacing_passphrase/POST/v2/system-volumes rename to internal/tpm/testdata/TestReplacePassphrase/Error_replacing_passphrase/POST/v2/system-volumes