-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #871 from Checkmarx/miryamFoifer/Update-Vorpal-Nam…
…e-AST-65647 Update Vorpal Name to ASCA(AST-65647)
- Loading branch information
Showing
28 changed files
with
371 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package asca | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"gotest.tools/assert" | ||
|
||
ascaconfig "github.com/checkmarx/ast-cli/internal/commands/asca/ascaconfig" | ||
"github.com/checkmarx/ast-cli/internal/services/osinstaller" | ||
) | ||
|
||
func TestInstallOrUpgrade_firstInstallation_Success(t *testing.T) { | ||
err := firstInstallation() | ||
assert.NilError(t, err, "Error on first installation of asca") | ||
fileExists, _ := osinstaller.FileExists(ascaconfig.Params.ExecutableFilePath()) | ||
assert.Assert(t, fileExists, "Executable file not found") | ||
fileExists, _ = osinstaller.FileExists(ascaconfig.Params.HashFilePath()) | ||
assert.Assert(t, fileExists, "Hash file not found") | ||
} | ||
|
||
func firstInstallation() error { | ||
os.RemoveAll(ascaconfig.Params.WorkingDir()) | ||
_, err := osinstaller.InstallOrUpgrade(&ascaconfig.Params) | ||
return err | ||
} | ||
|
||
func TestInstallOrUpgrade_installationIsUpToDate_Success(t *testing.T) { | ||
err := firstInstallation() | ||
assert.NilError(t, err, "Error on first installation of asca") | ||
_, err = osinstaller.InstallOrUpgrade(&ascaconfig.Params) | ||
assert.NilError(t, err, "Error when not need to upgrade") | ||
} | ||
|
||
func TestInstallOrUpgrade_installationIsNotUpToDate_Success(t *testing.T) { | ||
err := firstInstallation() | ||
assert.NilError(t, err, "Error on first installation of asca") | ||
changeHashFile() | ||
_, err = osinstaller.InstallOrUpgrade(&ascaconfig.Params) | ||
assert.NilError(t, err, "Error when need to upgrade") | ||
fileExists, _ := osinstaller.FileExists(ascaconfig.Params.ExecutableFilePath()) | ||
assert.Assert(t, fileExists, "Executable file not found") | ||
fileExists, _ = osinstaller.FileExists(ascaconfig.Params.HashFilePath()) | ||
assert.Assert(t, fileExists, "Hash file not found") | ||
} | ||
|
||
func changeHashFile() { | ||
content, _ := os.ReadFile(ascaconfig.Params.HashFilePath()) | ||
content[0]++ | ||
_ = os.WriteFile(ascaconfig.Params.HashFilePath(), content, os.ModePerm) | ||
} |
2 changes: 1 addition & 1 deletion
2
...s/vorpal/vorpalconfig/vorpal-linux-amd.go → ...ommands/asca/ascaconfig/asca-linux-amd.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/vorpal/vorpalconfig/vorpal-linux-arm.go → ...ommands/asca/ascaconfig/asca-linux-arm.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nds/vorpal/vorpalconfig/vorpal-mac-amd.go → .../commands/asca/ascaconfig/asca-mac-amd.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nds/vorpal/vorpalconfig/vorpal-mac-arm.go → .../commands/asca/ascaconfig/asca-mac-arm.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nds/vorpal/vorpalconfig/vorpal-windows.go → .../commands/asca/ascaconfig/asca-windows.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.