@@ -482,6 +482,81 @@ var _ = Describe("local service", func() {
482482 })
483483 })
484484 })
485+ Describe ("getting link IDs for a CRU card endpoint" , func () {
486+ var (
487+ linkIDs []string
488+ err error
489+ )
490+ When ("retrieving the link IDs for a CRU card endpoint" , func () {
491+ It ("should return the correct link IDs" , func () {
492+ linkIDs , err = svc .GetLinkIDsForCRUEndpoint ("flp001" , "0228" , "0" , false )
493+ Expect (err ).NotTo (HaveOccurred ())
494+ Expect (linkIDs ).To (ContainElements ("0" , "1" , "2" , "10" ))
495+ })
496+ It ("should return the correct enabled link IDs" , func () {
497+ linkIDs , err = svc .GetLinkIDsForCRUEndpoint ("flp001" , "0228" , "0" , true )
498+ Expect (err ).NotTo (HaveOccurred ())
499+ Expect (linkIDs ).To (ContainElements ("0" , "2" ))
500+ })
501+ })
502+ When ("retrieving the link IDs for a non-existing host" , func () {
503+ It ("should produce an error" , func () {
504+ linkIDs , err = svc .GetLinkIDsForCRUEndpoint ("NOPE" , "0228" , "0" , true )
505+ Expect (err ).To (HaveOccurred ())
506+ })
507+ })
508+ When ("retrieving the link IDs for a non-existing CRU card" , func () {
509+ It ("should produce an error" , func () {
510+ linkIDs , err = svc .GetLinkIDsForCRUEndpoint ("flp001" , "NOPE" , "0" , true )
511+ Expect (err ).To (HaveOccurred ())
512+ })
513+ })
514+ When ("retrieving the link IDs for a non-existing endpoint" , func () {
515+ It ("should produce an error" , func () {
516+ linkIDs , err = svc .GetLinkIDsForCRUEndpoint ("flp001" , "0228" , "NOPE" , true )
517+ Expect (err ).To (HaveOccurred ())
518+ })
519+ })
520+ When ("trying to retrieve the link IDs for an FLP belonging to a CRORC detector" , func () {
521+ It ("should produce an error" , func () {
522+ linkIDs , err = svc .GetLinkIDsForCRUEndpoint ("flp146" , "0110" , "0" , true )
523+ Expect (err ).To (HaveOccurred ())
524+ })
525+ })
526+ })
527+
528+ Describe ("getting aliased link IDs for a detector" , func () {
529+ var (
530+ linkIDs []string
531+ err error
532+ )
533+ When ("retrieving the link IDs for a detector" , func () {
534+ It ("should return the correct link IDs" , func () {
535+ linkIDs , err = svc .GetAliasedLinkIDsForDetector ("ABC" , false )
536+ Expect (err ).NotTo (HaveOccurred ())
537+ Expect (linkIDs ).To (Equal ([]string {"01" , "123" , "400" , "58" , "59" , "600" , "62" , "63" , "a-b_c=d" , "string" }))
538+ })
539+ })
540+ When ("retrieving the active link IDs for a detector" , func () {
541+ It ("should return the correct link IDs" , func () {
542+ linkIDs , err = svc .GetAliasedLinkIDsForDetector ("ABC" , true )
543+ Expect (err ).NotTo (HaveOccurred ())
544+ Expect (linkIDs ).To (Equal ([]string {"01" , "400" , "58" , "600" , "string" }))
545+ })
546+ })
547+ When ("retrieving the link IDs for a non-existing detector" , func () {
548+ It ("should produce an error" , func () {
549+ linkIDs , err = svc .GetAliasedLinkIDsForDetector ("NOPE" , false )
550+ Expect (err ).To (HaveOccurred ())
551+ })
552+ })
553+ When ("retrieving the link IDs for a detector without readoutcard config" , func () {
554+ It ("should produce an error" , func () {
555+ linkIDs , err = svc .GetAliasedLinkIDsForDetector ("DEF" , false )
556+ Expect (err ).To (HaveOccurred ())
557+ })
558+ })
559+ })
485560
486561 // TODO:
487562 // GetRuntimeEntry (currently not supporting yaml backend)
0 commit comments