github.com/ronaksoft/rony@v0.16.26-0.20230807065236-1743dbfe6959/edgetest/scenario.go (about)

     1  package edgetest
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  /*
     8     Creation Time: 2021 - Jan - 10
     9     Created by:  (ehsan)
    10     Maintainers:
    11        1.  Ehsan N. Moosa (E2)
    12     Auditor: Ehsan N. Moosa (E2)
    13     Copyright Ronak Software Group 2020
    14  */
    15  
    16  type scenario []context
    17  
    18  func newScenario() *scenario {
    19  	return &scenario{}
    20  }
    21  
    22  func (s *scenario) Append(c context) {
    23  	*s = append(*s, c)
    24  }
    25  
    26  func (s scenario) Run(timeout time.Duration) error {
    27  	for _, ctx := range s {
    28  		err := ctx.Run(timeout)
    29  		if err != nil {
    30  			return err
    31  		}
    32  	}
    33  
    34  	return nil
    35  }