Resolve "Internal Changes representation is not working as expected"
Merged
requested to merge 152-internal-changes-representation-is-not-working-as-expected into develop
Compare changes
- Malte Bauch authored
This change is needed to prevent that the stateManager goroutine is running forever. Now it will finish after the change has been confirmed. This is probably also the reason for the data race within the tests, because it seems to be a read/write race for t.done from within the test package. This is because the goroutine keeps running and triggers (because of the ticker) a t.Logf for a test which is already finished. TODO: A method should be added which allows to Cancel() a Change. Addresses: #152
+ 34
− 20
@@ -43,10 +44,12 @@ func NewChange(device uuid.UUID, currentState ygot.GoStruct, change ygot.GoStruc
@@ -43,10 +44,12 @@ func NewChange(device uuid.UUID, currentState ygot.GoStruct, change ygot.GoStruc
@@ -55,17 +58,18 @@ func NewChange(device uuid.UUID, currentState ygot.GoStruct, change ygot.GoStruc
@@ -55,17 +58,18 @@ func NewChange(device uuid.UUID, currentState ygot.GoStruct, change ygot.GoStruc
@@ -77,6 +81,7 @@ func (c *Change) ID() uuid.UUID {
@@ -77,6 +81,7 @@ func (c *Change) ID() uuid.UUID {
@@ -88,6 +93,7 @@ func (c *Change) Commit() error {
@@ -88,6 +93,7 @@ func (c *Change) Commit() error {
@@ -110,7 +116,7 @@ func (c *Change) State() ppb.Change_State {
@@ -110,7 +116,7 @@ func (c *Change) State() ppb.Change_State {
func stateManager(ch *Change, timeout time.Duration) (chan<- ppb.Change_State, <-chan ppb.Change_State, <-chan error) {
@@ -122,11 +128,13 @@ func stateManager(ch *Change, timeout time.Duration) (chan<- ppb.Change_State, <
@@ -122,11 +128,13 @@ func stateManager(ch *Change, timeout time.Duration) (chan<- ppb.Change_State, <
@@ -148,8 +156,9 @@ func stateManager(ch *Change, timeout time.Duration) (chan<- ppb.Change_State, <
@@ -148,8 +156,9 @@ func stateManager(ch *Change, timeout time.Duration) (chan<- ppb.Change_State, <
@@ -165,22 +174,27 @@ func stateManager(ch *Change, timeout time.Duration) (chan<- ppb.Change_State, <
@@ -165,22 +174,27 @@ func stateManager(ch *Change, timeout time.Duration) (chan<- ppb.Change_State, <