From e221082fed27468c1643536a2b053c5684baa62d Mon Sep 17 00:00:00 2001 From: adragusin Date: Thu, 6 Feb 2020 15:54:56 +0200 Subject: [PATCH] Updated IT tests in apier --- apier/v1/tpaccountactions_it_test.go | 34 +++++++++---------------- apier/v1/tpactionplans_it_test.go | 34 +++++++++---------------- apier/v1/tpactions_it_test.go | 34 +++++++++---------------- apier/v1/tpactiontriggers_it_test.go | 34 +++++++++---------------- apier/v1/tpattributes_it_test.go | 27 +++++++++----------- apier/v1/tpchargers_it_test.go | 28 ++++++++++----------- apier/v1/tpdestinationrates_it_test.go | 35 ++++++++++---------------- apier/v1/tpdestinations_it_test.go | 34 +++++++++---------------- apier/v1/tpdispatchers_it_test.go | 27 +++++++++----------- apier/v1/tpfilters_it_test.go | 33 +++++++++--------------- apier/v1/tprates_it_test.go | 34 +++++++++---------------- apier/v1/tpratingplans_it_test.go | 34 +++++++++---------------- apier/v1/tpratingprofiles_it_test.go | 34 +++++++++---------------- apier/v1/tpresources_it_test.go | 34 +++++++++---------------- apier/v1/tpsharedgroups_it_test.go | 34 +++++++++---------------- apier/v1/tpstats_it_test.go | 35 ++++++++++---------------- apier/v1/tpsuppliers_it_test.go | 27 +++++++++----------- apier/v1/tpthresholds_it_test.go | 34 +++++++++---------------- apier/v1/tptimings_it_test.go | 34 +++++++++---------------- integration_test.sh | 25 +++++++++++++----- 20 files changed, 250 insertions(+), 395 deletions(-) diff --git a/apier/v1/tpaccountactions_it_test.go b/apier/v1/tpaccountactions_it_test.go index b9d4036b7..ab659795c 100644 --- a/apier/v1/tpaccountactions_it_test.go +++ b/apier/v1/tpaccountactions_it_test.go @@ -63,29 +63,19 @@ var sTestsTPAccActions = []func(t *testing.T){ } //Test start here -func TestTPAccActionsITMySql(t *testing.T) { - tpAccActionsConfigDIR = "tutmysql" - for _, stest := range sTestsTPAccActions { - t.Run(tpAccActionsConfigDIR, stest) +func TestTPAccActionsIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpAccActionsConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpAccActionsConfigDIR = "tutmysql" + case utils.MetaMongo: + tpAccActionsConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpAccActionsConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPAccActionsITMongo(t *testing.T) { - tpAccActionsConfigDIR = "tutmongo" - for _, stest := range sTestsTPAccActions { - t.Run(tpAccActionsConfigDIR, stest) - } -} - -func TestTPAccActionsITPG(t *testing.T) { - tpAccActionsConfigDIR = "tutpostgres" - for _, stest := range sTestsTPAccActions { - t.Run(tpAccActionsConfigDIR, stest) - } -} - -func TestTPAccActionsITInternal(t *testing.T) { - tpAccActionsConfigDIR = "tutinternal" for _, stest := range sTestsTPAccActions { t.Run(tpAccActionsConfigDIR, stest) } diff --git a/apier/v1/tpactionplans_it_test.go b/apier/v1/tpactionplans_it_test.go index c0d303770..819e1b558 100644 --- a/apier/v1/tpactionplans_it_test.go +++ b/apier/v1/tpactionplans_it_test.go @@ -60,29 +60,19 @@ var sTestsTPAccPlans = []func(t *testing.T){ } //Test start here -func TestTPAccPlansITMySql(t *testing.T) { - tpAccPlansConfigDIR = "tutmysql" - for _, stest := range sTestsTPAccPlans { - t.Run(tpAccPlansConfigDIR, stest) +func TestTPAccPlansIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpAccPlansConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpAccPlansConfigDIR = "tutmysql" + case utils.MetaMongo: + tpAccPlansConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpAccPlansConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPAccPlansITMongo(t *testing.T) { - tpAccPlansConfigDIR = "tutmongo" - for _, stest := range sTestsTPAccPlans { - t.Run(tpAccPlansConfigDIR, stest) - } -} - -func TestTPAccPlansITPG(t *testing.T) { - tpAccPlansConfigDIR = "tutpostgres" - for _, stest := range sTestsTPAccPlans { - t.Run(tpAccPlansConfigDIR, stest) - } -} - -func TestTPAccPlansITInternal(t *testing.T) { - tpAccPlansConfigDIR = "tutinternal" for _, stest := range sTestsTPAccPlans { t.Run(tpAccPlansConfigDIR, stest) } diff --git a/apier/v1/tpactions_it_test.go b/apier/v1/tpactions_it_test.go index 137ac0c78..1b522a95e 100644 --- a/apier/v1/tpactions_it_test.go +++ b/apier/v1/tpactions_it_test.go @@ -60,29 +60,19 @@ var sTestsTPActions = []func(t *testing.T){ } //Test start here -func TestTPActionsITMySql(t *testing.T) { - tpActionConfigDIR = "tutmysql" - for _, stest := range sTestsTPActions { - t.Run(tpActionConfigDIR, stest) +func TestTPActionsIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpActionConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpActionConfigDIR = "tutmysql" + case utils.MetaMongo: + tpActionConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpActionConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPActionsITMongo(t *testing.T) { - tpActionConfigDIR = "tutmongo" - for _, stest := range sTestsTPActions { - t.Run(tpActionConfigDIR, stest) - } -} - -func TestTPActionsITPG(t *testing.T) { - tpActionConfigDIR = "tutpostgres" - for _, stest := range sTestsTPActions { - t.Run(tpActionConfigDIR, stest) - } -} - -func TestTPActionsITInternal(t *testing.T) { - tpActionConfigDIR = "tutinternal" for _, stest := range sTestsTPActions { t.Run(tpActionConfigDIR, stest) } diff --git a/apier/v1/tpactiontriggers_it_test.go b/apier/v1/tpactiontriggers_it_test.go index ecea476c8..eacf1affc 100644 --- a/apier/v1/tpactiontriggers_it_test.go +++ b/apier/v1/tpactiontriggers_it_test.go @@ -60,29 +60,19 @@ var sTestsTPActionTriggers = []func(t *testing.T){ } //Test start here -func TestTPActionTriggersITMySql(t *testing.T) { - tpActionTriggerConfigDIR = "tutmysql" - for _, stest := range sTestsTPActionTriggers { - t.Run(tpActionTriggerConfigDIR, stest) +func TestTPActionTriggersIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpActionTriggerConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpActionTriggerConfigDIR = "tutmysql" + case utils.MetaMongo: + tpActionTriggerConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpActionTriggerConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPActionTriggersITMongo(t *testing.T) { - tpActionTriggerConfigDIR = "tutmongo" - for _, stest := range sTestsTPActionTriggers { - t.Run(tpActionTriggerConfigDIR, stest) - } -} - -func TestTPActionTriggersITPG(t *testing.T) { - tpActionTriggerConfigDIR = "tutpostgres" - for _, stest := range sTestsTPActionTriggers { - t.Run(tpActionTriggerConfigDIR, stest) - } -} - -func TestTPActionTriggersITInternal(t *testing.T) { - tpActionTriggerConfigDIR = "tutinternal" for _, stest := range sTestsTPActionTriggers { t.Run(tpActionTriggerConfigDIR, stest) } diff --git a/apier/v1/tpattributes_it_test.go b/apier/v1/tpattributes_it_test.go index 7d71c69b3..3138e0bb3 100644 --- a/apier/v1/tpattributes_it_test.go +++ b/apier/v1/tpattributes_it_test.go @@ -61,22 +61,19 @@ var sTestsTPAlsPrf = []func(t *testing.T){ } //Test start here -func TestTPAlsPrfITMySql(t *testing.T) { - tpAlsPrfConfigDIR = "tutmysql" - for _, stest := range sTestsTPAlsPrf { - t.Run(tpAlsPrfConfigDIR, stest) +func TestTPAlsPrfIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpAlsPrfConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpAlsPrfConfigDIR = "tutmysql" + case utils.MetaMongo: + tpAlsPrfConfigDIR = "tutmongo" + case utils.MetaPostgres: + t.SkipNow() + default: + t.Fatal("Unknown Database type") } -} - -func TestTPAlsPrfITMongo(t *testing.T) { - tpAlsPrfConfigDIR = "tutmongo" - for _, stest := range sTestsTPAlsPrf { - t.Run(tpAlsPrfConfigDIR, stest) - } -} - -func TestTPAlsPrfITInternal(t *testing.T) { - tpAlsPrfConfigDIR = "tutinternal" for _, stest := range sTestsTPAlsPrf { t.Run(tpAlsPrfConfigDIR, stest) } diff --git a/apier/v1/tpchargers_it_test.go b/apier/v1/tpchargers_it_test.go index d8eb48fe1..ce57333e9 100644 --- a/apier/v1/tpchargers_it_test.go +++ b/apier/v1/tpchargers_it_test.go @@ -60,27 +60,25 @@ var sTestsTPChrgs = []func(t *testing.T){ } //Test start here -func TestTPChrgsITMySql(t *testing.T) { +func TestTPChrgsIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpChrgsConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpChrgsConfigDIR = "tutmysql" + case utils.MetaMongo: + tpChrgsConfigDIR = "tutmongo" + case utils.MetaPostgres: + t.SkipNow() + default: + t.Fatal("Unknown Database type") + } tpChrgsConfigDIR = "tutmysql" for _, stest := range sTestsTPChrgs { t.Run(tpChrgsConfigDIR, stest) } } -func TestTPChrgsITMongo(t *testing.T) { - tpChrgsConfigDIR = "tutmongo" - for _, stest := range sTestsTPChrgs { - t.Run(tpChrgsConfigDIR, stest) - } -} - -func TestTPChrgsITInternal(t *testing.T) { - tpChrgsConfigDIR = "tutinternal" - for _, stest := range sTestsTPChrgs { - t.Run(tpChrgsConfigDIR, stest) - } -} - func testTPChrgsInitCfg(t *testing.T) { var err error tpChrgsCfgPath = path.Join(tpChrgsDataDir, "conf", "samples", tpChrgsConfigDIR) diff --git a/apier/v1/tpdestinationrates_it_test.go b/apier/v1/tpdestinationrates_it_test.go index 27a65aeef..2cc1cfd41 100644 --- a/apier/v1/tpdestinationrates_it_test.go +++ b/apier/v1/tpdestinationrates_it_test.go @@ -59,34 +59,25 @@ var sTestsTPDstRates = []func(t *testing.T){ } //Test start here -func TestTPDstRateITMySql(t *testing.T) { +func TestTPDstRateIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpDstRateConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpDstRateConfigDIR = "tutmysql" + case utils.MetaMongo: + tpDstRateConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpDstRateConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") + } tpDstRateConfigDIR = "tutmysql" for _, stest := range sTestsTPDstRates { t.Run(tpDstRateConfigDIR, stest) } } -func TestTPDstRateITMongo(t *testing.T) { - tpDstRateConfigDIR = "tutmongo" - for _, stest := range sTestsTPDstRates { - t.Run(tpDstRateConfigDIR, stest) - } -} - -func TestTPDstRateITPG(t *testing.T) { - tpDstRateConfigDIR = "tutpostgres" - for _, stest := range sTestsTPDstRates { - t.Run(tpDstRateConfigDIR, stest) - } -} - -func TestTPDstRateITInternal(t *testing.T) { - tpDstRateConfigDIR = "tutinternal" - for _, stest := range sTestsTPDstRates { - t.Run(tpDstRateConfigDIR, stest) - } -} - func testTPDstRateInitCfg(t *testing.T) { var err error tpDstRateCfgPath = path.Join(tpDstRateDataDir, "conf", "samples", tpDstRateConfigDIR) diff --git a/apier/v1/tpdestinations_it_test.go b/apier/v1/tpdestinations_it_test.go index 1a0cbd009..bd2b34c6b 100644 --- a/apier/v1/tpdestinations_it_test.go +++ b/apier/v1/tpdestinations_it_test.go @@ -59,29 +59,19 @@ var sTestsTPDestinations = []func(t *testing.T){ } //Test start here -func TestTPDestinationsITMySql(t *testing.T) { - tpDestinationConfigDIR = "tutmysql" - for _, stest := range sTestsTPDestinations { - t.Run(tpDestinationConfigDIR, stest) +func TestTPDestinationsIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpDestinationConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpDestinationConfigDIR = "tutmysql" + case utils.MetaMongo: + tpDestinationConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpDestinationConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPDestinationsITMongo(t *testing.T) { - tpDestinationConfigDIR = "tutmongo" - for _, stest := range sTestsTPDestinations { - t.Run(tpDestinationConfigDIR, stest) - } -} - -func TestTPDestinationsITPG(t *testing.T) { - tpDestinationConfigDIR = "tutpostgres" - for _, stest := range sTestsTPDestinations { - t.Run(tpDestinationConfigDIR, stest) - } -} - -func TestTPDestinationsITInternal(t *testing.T) { - tpDestinationConfigDIR = "tutinternal" for _, stest := range sTestsTPDestinations { t.Run(tpDestinationConfigDIR, stest) } diff --git a/apier/v1/tpdispatchers_it_test.go b/apier/v1/tpdispatchers_it_test.go index 3ffc75eb4..1a5a8680a 100644 --- a/apier/v1/tpdispatchers_it_test.go +++ b/apier/v1/tpdispatchers_it_test.go @@ -59,22 +59,19 @@ var sTestsTPDispatchers = []func(t *testing.T){ } //Test start here -func TestTPDispatcherITMySql(t *testing.T) { - tpDispatcherConfigDIR = "tutmysql" - for _, stest := range sTestsTPDispatchers { - t.Run(tpDispatcherConfigDIR, stest) +func TestTPDispatcherIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpDispatcherConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpDispatcherConfigDIR = "tutmysql" + case utils.MetaMongo: + tpDispatcherConfigDIR = "tutmongo" + case utils.MetaPostgres: + t.SkipNow() + default: + t.Fatal("Unknown Database type") } -} - -func TestTPDispatcherITMongo(t *testing.T) { - tpDispatcherConfigDIR = "tutmongo" - for _, stest := range sTestsTPDispatchers { - t.Run(tpDispatcherConfigDIR, stest) - } -} - -func TestTPDispatcherITInternal(t *testing.T) { - tpDispatcherConfigDIR = "tutinternal" for _, stest := range sTestsTPDispatchers { t.Run(tpDispatcherConfigDIR, stest) } diff --git a/apier/v1/tpfilters_it_test.go b/apier/v1/tpfilters_it_test.go index 77b2c3883..8494db9cc 100644 --- a/apier/v1/tpfilters_it_test.go +++ b/apier/v1/tpfilters_it_test.go @@ -62,33 +62,24 @@ var sTestsTPFilters = []func(t *testing.T){ //Test start here func TestTPFilterITMySql(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpFilterConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpFilterConfigDIR = "tutmysql" + case utils.MetaMongo: + tpFilterConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpFilterConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") + } tpFilterConfigDIR = "tutmysql" for _, stest := range sTestsTPFilters { t.Run(tpFilterConfigDIR, stest) } } -func TestTPFilterITMongo(t *testing.T) { - tpFilterConfigDIR = "tutmongo" - for _, stest := range sTestsTPFilters { - t.Run(tpFilterConfigDIR, stest) - } -} - -func TestTPFilterITPG(t *testing.T) { - tpFilterConfigDIR = "tutpostgres" - for _, stest := range sTestsTPFilters { - t.Run(tpFilterConfigDIR, stest) - } -} - -func TestTPFilterITInternal(t *testing.T) { - tpFilterConfigDIR = "tutinternal" - for _, stest := range sTestsTPFilters { - t.Run(tpFilterConfigDIR, stest) - } -} - func testTPFilterInitCfg(t *testing.T) { var err error tpFilterCfgPath = path.Join(tpFilterDataDir, "conf", "samples", tpFilterConfigDIR) diff --git a/apier/v1/tprates_it_test.go b/apier/v1/tprates_it_test.go index 010ce23c4..06809907d 100644 --- a/apier/v1/tprates_it_test.go +++ b/apier/v1/tprates_it_test.go @@ -59,29 +59,19 @@ var sTestsTPRates = []func(t *testing.T){ } //Test start here -func TestTPRatesITMySql(t *testing.T) { - tpRateConfigDIR = "tutmysql" - for _, stest := range sTestsTPRates { - t.Run(tpRateConfigDIR, stest) +func TestTPRatesIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpRateConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpRateConfigDIR = "tutmysql" + case utils.MetaMongo: + tpRateConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpRateConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPRatesITMongo(t *testing.T) { - tpRateConfigDIR = "tutmongo" - for _, stest := range sTestsTPRates { - t.Run(tpRateConfigDIR, stest) - } -} - -func TestTPRatesITPG(t *testing.T) { - tpRateConfigDIR = "tutpostgres" - for _, stest := range sTestsTPRates { - t.Run(tpRateConfigDIR, stest) - } -} - -func TestTPRatesITInternal(t *testing.T) { - tpRateConfigDIR = "tutinternal" for _, stest := range sTestsTPRates { t.Run(tpRateConfigDIR, stest) } diff --git a/apier/v1/tpratingplans_it_test.go b/apier/v1/tpratingplans_it_test.go index 16b7694f0..0f32684cf 100644 --- a/apier/v1/tpratingplans_it_test.go +++ b/apier/v1/tpratingplans_it_test.go @@ -59,29 +59,19 @@ var sTestsTPRatingPlans = []func(t *testing.T){ } //Test start here -func TestTPRatingPlansITMySql(t *testing.T) { - tpRatingPlanConfigDIR = "tutmysql" - for _, stest := range sTestsTPRatingPlans { - t.Run(tpRatingPlanConfigDIR, stest) +func TestTPRatingPlansIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpRatingPlanConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpRatingPlanConfigDIR = "tutmysql" + case utils.MetaMongo: + tpRatingPlanConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpRatingPlanConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPRatingPlansITMongo(t *testing.T) { - tpRatingPlanConfigDIR = "tutmongo" - for _, stest := range sTestsTPRatingPlans { - t.Run(tpRatingPlanConfigDIR, stest) - } -} - -func TestTPRatingPlansITPG(t *testing.T) { - tpRatingPlanConfigDIR = "tutpostgres" - for _, stest := range sTestsTPRatingPlans { - t.Run(tpRatingPlanConfigDIR, stest) - } -} - -func TestTPRatingPlansITInternal(t *testing.T) { - tpRatingPlanConfigDIR = "tutinternal" for _, stest := range sTestsTPRatingPlans { t.Run(tpRatingPlanConfigDIR, stest) } diff --git a/apier/v1/tpratingprofiles_it_test.go b/apier/v1/tpratingprofiles_it_test.go index 253ea9b20..9c170fb5a 100644 --- a/apier/v1/tpratingprofiles_it_test.go +++ b/apier/v1/tpratingprofiles_it_test.go @@ -63,29 +63,19 @@ var sTestsTPRatingProfiles = []func(t *testing.T){ } //Test start here -func TestTPRatingProfilesITMySql(t *testing.T) { - tpRatingProfileConfigDIR = "tutmysql" - for _, stest := range sTestsTPRatingProfiles { - t.Run(tpRatingProfileConfigDIR, stest) +func TestTPRatingProfilesIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpRatingProfileConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpRatingProfileConfigDIR = "tutmysql" + case utils.MetaMongo: + tpRatingProfileConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpRatingProfileConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPRatingProfilesITMongo(t *testing.T) { - tpRatingProfileConfigDIR = "tutmongo" - for _, stest := range sTestsTPRatingProfiles { - t.Run(tpRatingProfileConfigDIR, stest) - } -} - -func TestTPRatingProfilesITPG(t *testing.T) { - tpRatingProfileConfigDIR = "tutpostgres" - for _, stest := range sTestsTPRatingProfiles { - t.Run(tpRatingProfileConfigDIR, stest) - } -} - -func TestTPRatingProfilesITInternal(t *testing.T) { - tpRatingProfileConfigDIR = "tutinternal" for _, stest := range sTestsTPRatingProfiles { t.Run(tpRatingProfileConfigDIR, stest) } diff --git a/apier/v1/tpresources_it_test.go b/apier/v1/tpresources_it_test.go index 076f2c1b5..3d71384df 100644 --- a/apier/v1/tpresources_it_test.go +++ b/apier/v1/tpresources_it_test.go @@ -59,29 +59,19 @@ var sTestsTPResources = []func(t *testing.T){ } //Test start here -func TestTPResITMySql(t *testing.T) { - tpResConfigDIR = "tutmysql" - for _, stest := range sTestsTPResources { - t.Run(tpResConfigDIR, stest) +func TestTPResIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpResConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpResConfigDIR = "tutmysql" + case utils.MetaMongo: + tpResConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpResConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPResITMongo(t *testing.T) { - tpResConfigDIR = "tutmongo" - for _, stest := range sTestsTPResources { - t.Run(tpResConfigDIR, stest) - } -} - -func TestTPResITPG(t *testing.T) { - tpResConfigDIR = "tutpostgres" - for _, stest := range sTestsTPResources { - t.Run(tpResConfigDIR, stest) - } -} - -func TestTPResITInternal(t *testing.T) { - tpResConfigDIR = "tutinternal" for _, stest := range sTestsTPResources { t.Run(tpResConfigDIR, stest) } diff --git a/apier/v1/tpsharedgroups_it_test.go b/apier/v1/tpsharedgroups_it_test.go index 99018d316..b4b792dc3 100644 --- a/apier/v1/tpsharedgroups_it_test.go +++ b/apier/v1/tpsharedgroups_it_test.go @@ -59,29 +59,19 @@ var sTestsTPSharedGroups = []func(t *testing.T){ } //Test start here -func TestTPSharedGroupsITMySql(t *testing.T) { - tpSharedGroupConfigDIR = "tutmysql" - for _, stest := range sTestsTPSharedGroups { - t.Run(tpSharedGroupConfigDIR, stest) +func TestTPSharedGroupsIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpSharedGroupConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpSharedGroupConfigDIR = "tutmysql" + case utils.MetaMongo: + tpSharedGroupConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpSharedGroupConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPSharedGroupsITMongo(t *testing.T) { - tpSharedGroupConfigDIR = "tutmongo" - for _, stest := range sTestsTPSharedGroups { - t.Run(tpSharedGroupConfigDIR, stest) - } -} - -func TestTPSharedGroupsITPG(t *testing.T) { - tpSharedGroupConfigDIR = "tutpostgres" - for _, stest := range sTestsTPSharedGroups { - t.Run(tpSharedGroupConfigDIR, stest) - } -} - -func TestTPSharedGroupsITInternal(t *testing.T) { - tpSharedGroupConfigDIR = "tutinternal" for _, stest := range sTestsTPSharedGroups { t.Run(tpSharedGroupConfigDIR, stest) } diff --git a/apier/v1/tpstats_it_test.go b/apier/v1/tpstats_it_test.go index 93e601767..155104463 100644 --- a/apier/v1/tpstats_it_test.go +++ b/apier/v1/tpstats_it_test.go @@ -60,34 +60,25 @@ var sTestsTPStats = []func(t *testing.T){ } //Test start here -func TestTPStatITMySql(t *testing.T) { +func TestTPStatIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpStatConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpStatConfigDIR = "tutmysql" + case utils.MetaMongo: + tpStatConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpStatConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") + } tpStatConfigDIR = "tutmysql" for _, stest := range sTestsTPStats { t.Run(tpStatConfigDIR, stest) } } -func TestTPStatITMongo(t *testing.T) { - tpStatConfigDIR = "tutmongo" - for _, stest := range sTestsTPStats { - t.Run(tpStatConfigDIR, stest) - } -} - -func TestTPStatITPG(t *testing.T) { - tpStatConfigDIR = "tutpostgres" - for _, stest := range sTestsTPStats { - t.Run(tpStatConfigDIR, stest) - } -} - -func TestTPStatITInternal(t *testing.T) { - tpStatConfigDIR = "tutinternal" - for _, stest := range sTestsTPStats { - t.Run(tpStatConfigDIR, stest) - } -} - func testTPStatsInitCfg(t *testing.T) { var err error tpStatCfgPath = path.Join(tpStatDataDir, "conf", "samples", tpStatConfigDIR) diff --git a/apier/v1/tpsuppliers_it_test.go b/apier/v1/tpsuppliers_it_test.go index fd5c050c8..2eba96869 100644 --- a/apier/v1/tpsuppliers_it_test.go +++ b/apier/v1/tpsuppliers_it_test.go @@ -61,22 +61,19 @@ var sTestsTPSplPrf = []func(t *testing.T){ } //Test start here -func TestTPSplPrfITMySql(t *testing.T) { - tpSplPrfConfigDIR = "tutmysql" - for _, stest := range sTestsTPSplPrf { - t.Run(tpSplPrfConfigDIR, stest) +func TestTPSplPrfIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpSplPrfConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpSplPrfConfigDIR = "tutmysql" + case utils.MetaMongo: + tpSplPrfConfigDIR = "tutmongo" + case utils.MetaPostgres: + t.SkipNow() + default: + t.Fatal("Unknown Database type") } -} - -func TestTPSplPrfITMongo(t *testing.T) { - tpSplPrfConfigDIR = "tutmongo" - for _, stest := range sTestsTPSplPrf { - t.Run(tpSplPrfConfigDIR, stest) - } -} - -func TestTPSplPrfITInternal(t *testing.T) { - tpSplPrfConfigDIR = "tutinternal" for _, stest := range sTestsTPSplPrf { t.Run(tpSplPrfConfigDIR, stest) } diff --git a/apier/v1/tpthresholds_it_test.go b/apier/v1/tpthresholds_it_test.go index 8d699be57..822295d39 100644 --- a/apier/v1/tpthresholds_it_test.go +++ b/apier/v1/tpthresholds_it_test.go @@ -60,29 +60,19 @@ var sTestsTPThreshold = []func(t *testing.T){ } //Test start here -func TestTPThresholdITMySql(t *testing.T) { - tpThresholdConfigDIR = "tutmysql" - for _, stest := range sTestsTPThreshold { - t.Run(tpThresholdConfigDIR, stest) +func TestTPThresholdIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpThresholdConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpThresholdConfigDIR = "tutmysql" + case utils.MetaMongo: + tpThresholdConfigDIR = "tutmongo" + case utils.MetaPostgres: + tpThresholdConfigDIR = "tutpostgres" + default: + t.Fatal("Unknown Database type") } -} - -func TestTPThresholdITMongo(t *testing.T) { - tpThresholdConfigDIR = "tutmongo" - for _, stest := range sTestsTPThreshold { - t.Run(tpThresholdConfigDIR, stest) - } -} - -func TestTPThresholdITPG(t *testing.T) { - tpThresholdConfigDIR = "tutpostgres" - for _, stest := range sTestsTPThreshold { - t.Run(tpThresholdConfigDIR, stest) - } -} - -func TestTPThresholdITInternal(t *testing.T) { - tpThresholdConfigDIR = "tutinternal" for _, stest := range sTestsTPThreshold { t.Run(tpThresholdConfigDIR, stest) } diff --git a/apier/v1/tptimings_it_test.go b/apier/v1/tptimings_it_test.go index fe74c4775..3f4936ec8 100644 --- a/apier/v1/tptimings_it_test.go +++ b/apier/v1/tptimings_it_test.go @@ -59,29 +59,19 @@ var sTestsTPTiming = []func(t *testing.T){ } //Test start here -func TestTPTimingITMySql(t *testing.T) { - tpTimingConfigDIR = "tutmysql" - for _, stest := range sTestsTPTiming { - t.Run(tpTimingConfigDIR, stest) +func TestTPTimingIT(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + tpTimingConfigDIR = "tutinternal" + case utils.MetaMySQL: + tpTimingConfigDIR = "tutmysql" + case utils.MetaMongo: + tpTimingConfigDIR = "tutmongo" + case utils.MetaPostgres: + t.SkipNow() + default: + t.Fatal("Unknown Database type") } -} - -func TestTPTimingITMongo(t *testing.T) { - tpTimingConfigDIR = "tutmongo" - for _, stest := range sTestsTPTiming { - t.Run(tpTimingConfigDIR, stest) - } -} - -func TestTPTimingITPG(t *testing.T) { - tpTimingConfigDIR = "tutpostgres" - for _, stest := range sTestsTPTiming { - t.Run(tpTimingConfigDIR, stest) - } -} - -func TestTPTimingITInternal(t *testing.T) { - tpTimingConfigDIR = "tutinternal" for _, stest := range sTestsTPTiming { t.Run(tpTimingConfigDIR, stest) } diff --git a/integration_test.sh b/integration_test.sh index c40837e62..6e7fb00c5 100755 --- a/integration_test.sh +++ b/integration_test.sh @@ -31,6 +31,9 @@ smg_internal=$? echo 'go test github.com/cgrates/cgrates/dispatchers -tags=integration -dbtype=*internal' go test github.com/cgrates/cgrates/dispatchers -tags=integration -dbtype=*internal dis_internal=$? +echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=offline -dbtype=*internal' +go test github.com/cgrates/cgrates/apier/v1 -tags=offline -dbtype=*internal +offline_internal=$? # SQL echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*mysql' go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*mysql @@ -59,6 +62,9 @@ smg_mysql=$? echo 'go test github.com/cgrates/cgrates/dispatchers -tags=integration -dbtype=*mysql' go test github.com/cgrates/cgrates/dispatchers -tags=integration -dbtype=*mysql dis_mysql=$? +echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=offline -dbtype=*mysql' +go test github.com/cgrates/cgrates/apier/v1 -tags=offline -dbtype=*mysql +offline_mysql=$? # Mongo echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*mongo' go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*mongo @@ -87,6 +93,9 @@ smg_mongo=$? echo 'go test github.com/cgrates/cgrates/dispatchers -tags=integration -dbtype=*mongo' go test github.com/cgrates/cgrates/dispatchers -tags=integration -dbtype=*mongo dis_mongo=$? +echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=offline -dbtype=*mongo' +go test github.com/cgrates/cgrates/apier/v1 -tags=offline -dbtype=*mongo +offline_mongo=$? # Postgres echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*postgres' go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*postgres @@ -115,6 +124,9 @@ smg_postgres=$? echo 'go test github.com/cgrates/cgrates/dispatchers -tags=integration -dbtype=*postgres' go test github.com/cgrates/cgrates/dispatchers -tags=integration -dbtype=*postgres dis_postgres=$? +echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=offline -dbtype=*postgres' +go test github.com/cgrates/cgrates/apier/v1 -tags=offline -dbtype=*postgres +offline_postgres=$? echo 'go test github.com/cgrates/cgrates/config -tags=integration' go test github.com/cgrates/cgrates/config -tags=integration @@ -125,10 +137,11 @@ mgr=$? echo 'go test github.com/cgrates/cgrates/services -tags=integration' go test github.com/cgrates/cgrates/services -tags=integration srv=$? -#All -echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=offline' -go test github.com/cgrates/cgrates/apier/v1 -tags=offline -offline=$? -# to do: add '&& $ap1_internal' -exit $gen && $ap1_sql && $ap1_mongo && $ap2 && $en && $cfg && $utl && $gnr && $agts && $smg && $mgr && $dis && $lds && $ers && $srv && $offline +exit $gen && $ap1_internal && $ap2_internal && $en_internal && $ers_internal && $lds_internal && +$gnr_internal && $agts_internal && $smg_internal && $dis_internal && $offline_internal && $ap1_mysql && +$ap2_mysql && $en_mysql && $ers_mysql && $lds_mysql && $gnr_mysql && $agts_mysql && $smg_mysql && +$dis_mysql && $offline_mysql && $ap1_mongo && $ap2_mongo && $en_mongo && $ers_mongo && $lds_mongo && +$gnr_mongo && $agts_mongo && $smg_mongo && $dis_mongo && $offline_mongo && $ap1_postgres && +$ap2_postgres && $en_postgres && $ers_postgres && $lds_postgres && $gnr_postgres && $agts_postgres && +$smg_postgres && $dis_postgres && $offline_postgres && $cfg && $mgr && $srv \ No newline at end of file