@@ -39,7 +39,6 @@ func buildInjector(templateRenderer template.TemplateRenderer, omnitruckURL stri
3939 do .ProvideNamedValue [config.ServiceConfig ](injector , "config" , config.ServiceConfig {
4040 LicenseServiceUrl : "http://license-service" ,
4141 OmnitruckUrl : omnitruckURL ,
42- SupportInfra19 : true ,
4342 })
4443 return injector
4544}
@@ -363,7 +362,6 @@ func TestDownloadService_Platforms(t *testing.T) {
363362 do .ProvideNamedValue [constants.ApiType ](injector , "mode" , constants .Commercial )
364363 do .ProvideNamedValue [config.ServiceConfig ](injector , "config" , config.ServiceConfig {
365364 OmnitruckUrl : ts .URL ,
366- SupportInfra19 : true ,
367365 })
368366
369367 locals := map [string ]interface {}{"license_id" : "123" }
@@ -825,88 +823,6 @@ func TestDownloadService_RelatedProducts(t *testing.T) {
825823 }
826824}
827825
828- func TestDownloadService_RelatedProducts_SupportInfra19 (t * testing.T ) {
829- t .Parallel ()
830-
831- logEntry := logrus .NewEntry (logrus .New ())
832- locals := map [string ]interface {}{"base_url" : "http://example.com" }
833-
834- tests := []struct {
835- name string
836- supportInfra19 bool
837- expectedProducts []string
838- unexpectedProducts []string
839- }{
840- {
841- name : "SupportInfra19 true - includes infra products" ,
842- supportInfra19 : true ,
843- expectedProducts : []string {"chef" , "chef-ice" , "migrate-ice" },
844- unexpectedProducts : []string {},
845- },
846- {
847- name : "SupportInfra19 false - excludes infra products" ,
848- supportInfra19 : false ,
849- expectedProducts : []string {"chef" },
850- unexpectedProducts : []string {"chef-ice" , "migrate-ice" },
851- },
852- }
853-
854- for _ , tt := range tests {
855- tt := tt
856- t .Run (tt .name , func (t * testing.T ) {
857- t .Parallel ()
858-
859- injector := do .New ()
860- do .ProvideNamedValue [dboperations.IDbOperations ](injector , "dbService" , & dboperations.MockIDbOperations {
861- GetRelatedProductsfunc : func (partitionValue string ) (* models.RelatedProducts , error ) {
862- return & models.RelatedProducts {
863- Bom : "test-bom" ,
864- Products : map [string ]string {
865- "chef" : "Chef Infra Client" ,
866- "chef-ice" : "Chef Infra Client Enterprise" ,
867- "migrate-ice" : "Migrate ICE" ,
868- "automate" : "Chef Automate" ,
869- },
870- }, nil
871- },
872- })
873- do .ProvideNamedValue [template.TemplateRenderer ](injector , "templateRenderer" , & template.MockTemplateRenderer {})
874- do .ProvideNamedValue [replicated.IReplicated ](injector , "replicated" , & replicated.MockReplicated {})
875- do .ProvideNamedValue [clients.ILicense ](injector , "licenseClient" , & clients.MockLicense {})
876- do .ProvideNamedValue [constants.ApiType ](injector , "mode" , constants .Commercial )
877- do .ProvideNamedValue [config.ServiceConfig ](injector , "config" , config.ServiceConfig {
878- SupportInfra19 : tt .supportInfra19 ,
879- })
880-
881- svc , err := NewDownloadService (injector , logEntry , locals )
882- require .NoError (t , err )
883-
884- params := & omnitruck.RequestParams {
885- BOM : "test-bom" ,
886- }
887-
888- data , req := svc .RelatedProducts (params )
889-
890- assert .True (t , req .Ok , "expected ok true" )
891- assert .Equal (t , fiber .StatusOK , req .Code )
892- assert .NotNil (t , data )
893-
894- products , ok := data ["relatedProducts" ].(map [string ]string )
895- assert .True (t , ok , "expected relatedProducts to be map[string]string" )
896-
897- // Check expected products are present
898- for _ , product := range tt .expectedProducts {
899- assert .Contains (t , products , product , "expected product %s to be present" , product )
900- }
901-
902- // Check unexpected products are not present
903- for _ , product := range tt .unexpectedProducts {
904- assert .NotContains (t , products , product , "expected product %s to be excluded" , product )
905- }
906- })
907- }
908- }
909-
910826func TestDownloadService_GetFileName_InvalidProduct (t * testing.T ) {
911827 t .Parallel ()
912828
0 commit comments