Skip to content

Commit b43ef59

Browse files
committed
tests: add mandatory virustotal test
chore: atlas migrate in ci
1 parent 98442f5 commit b43ef59

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.github/workflows/generated.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
- name: Hash migrations
1717
run: atlas migrate hash --dir "file://migrations/sql?format=golang-migrate"
1818

19+
- name: Make sure all changes generated
20+
run: atlas migrate diff ci_migration --dir "file://migrations/sql?format=golang-migrate" --to "ent://db/schema" --dev-url "docker://postgres/16/test?search_path=public"
21+
1922
- name: Ensure no changes
2023
run: git diff --exit-code
2124

tests/version_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ const testModPath = "testdata/FicsitRemoteMonitoring-0.10.3.smod"
3434
// TODO Add rate limit test
3535

3636
func TestVersionSuccess(t *testing.T) {
37-
RunVersionTestWrapper(t, testModPath, viper.IsSet("virustotal.key") && viper.GetString("virustotal.key") != "", "FicsitRemoteMonitoring", "")
37+
RunVersionTestWrapper(t, testModPath, false, "FicsitRemoteMonitoring", "")
38+
}
39+
40+
func TestVersionVirustotal(t *testing.T) {
41+
RunVersionTestWrapper(t, testModPath, true, "FicsitRemoteMonitoring", "")
3842
}
3943

4044
func TestVersionWrongModReference(t *testing.T) {
@@ -72,6 +76,12 @@ func RunVersionTestWrapper(t *testing.T, modFilePath string, executeVirusCheck b
7276
}
7377

7478
func RunVersionTest(ctx context.Context, t *testing.T, client *graphql.Client, modFilePath string, executeVirusCheck bool, modReference string, reuseModID string, expectError string) string {
79+
if executeVirusCheck && !(viper.IsSet("virustotal.key") && viper.GetString("virustotal.key") != "") {
80+
println("missing virustotal key from config")
81+
t.FailNow()
82+
return ""
83+
}
84+
7585
viper.Set("skip-virus-check", !executeVirusCheck)
7686

7787
token, _, err := makeUser(ctx)

0 commit comments

Comments
 (0)