github.com/confluentinc/cli@v1.100.0/test/audit_log_migration_test.go (about) 1 package test 2 3 import ( 4 "fmt" 5 "path/filepath" 6 "runtime" 7 ) 8 9 func (s *CLITestSuite) TestAuditConfigMigrate() { 10 migration1 := getInputFixturePath("config-migration-server1.golden", s) 11 migration2 := getInputFixturePath("config-migration-server2.golden", s) 12 13 malformed := getInputFixturePath("malformed-migration.golden", s) 14 nullFields := getInputFixturePath("null-fields-migration.golden", s) 15 16 tests := []CLITest{ 17 { 18 args: fmt.Sprintf("audit-log migrate config --combine cluster123=%s,clusterABC=%s "+ 19 "--bootstrap-servers new_bootstrap_2 --bootstrap-servers new_bootstrap_1 --authority NEW.CRN.AUTHORITY.COM", migration1, migration2), 20 fixture: "auditlog/migration-result-with-warnings.golden", 21 }, 22 { 23 args: fmt.Sprintf("audit-log migrate config --combine cluster123=%s,clusterABC=%s "+ 24 "--bootstrap-servers new_bootstrap_2", malformed, migration2), 25 contains: "Ignoring property file", 26 }, 27 { 28 args: fmt.Sprintf("audit-log migrate config --combine cluster123=%s,clusterABC=%s", nullFields, nullFields), 29 fixture: "auditlog/empty-migration-result.golden", 30 }, 31 } 32 33 loginURL := serveMds(s.T()).URL 34 35 for _, tt := range tests { 36 tt.login = "default" 37 s.runConfluentTest(tt, loginURL) 38 } 39 } 40 41 func getInputFixturePath(file string, suite *CLITestSuite) string { 42 _, callerFileName, _, ok := runtime.Caller(0) 43 if !ok { 44 suite.Fail("problems recovering caller information") 45 } 46 return filepath.Join(filepath.Dir(callerFileName), "fixtures", "input", "auditlog", file) 47 }