[VOL-5054] - Triage build for voltha-openolt-adapter
cmd/*.go
internal/pkg/*.go
pkg/mocks/*.go
=================
o Run gofmt -w -s on all non-(vendor/) golang sources (~make lint).
o Release triage jobs have been failing on unrelated source problems.
config.mk
makefiles/docker/
makefiles/etc/
makefiles/targets/
makefiles/virtualenv.mk
=======================
o https://github.com/opencord/onf-make.git
o Copy in library makefiles, esp docker/include.mk
Makefile
========
o Refactor and replace inline GO= and docker macros with docker/include.
o Added manual flag LOCAL_FIX_PERMS=1 to grant docker image write access.
o Target: mod-update
- Split logic into targets mod-tidy and mod-vendor.
- Display a banner when target runs for readability.
- Target lint-mod now calls mod-update VS inlining make mod tidy & vendor
o Target: test
- Split logic into 3 distinct targets now that stdout/stderr handled.
- Improve error handling, fail early VS accumulating status then exit
- Display a banner when targets process for log readability.
- Define macros for *.out and *.xml to avoid repeating logfile paths.
Change-Id: Ia2eb999f6176ce2eb46e41f55aee74c05b5a4cd2
diff --git a/internal/pkg/core/device_handler_test.go b/internal/pkg/core/device_handler_test.go
index 4c9a00f..8c41952 100644
--- a/internal/pkg/core/device_handler_test.go
+++ b/internal/pkg/core/device_handler_test.go
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//Package core provides the utility for olt devices, flows and statistics
+// Package core provides the utility for olt devices, flows and statistics
package core
import (
@@ -1147,7 +1147,6 @@
}
}
-//
func TestDeviceHandler_doStateUp(t *testing.T) {
dh1 := newMockDeviceHandler()
dh2 := newMockDeviceHandler()
@@ -1374,66 +1373,68 @@
}
}
-/* We are not using the adapterPreviouslyConnected and agentPreviouslyConnected flags now to check for reboots and reconnects
+/*
+ We are not using the adapterPreviouslyConnected and agentPreviouslyConnected flags now to check for reboots and reconnects
+
commenting out all the tests related to these
func TestDeviceHandler_TestReconcileStatus(t *testing.T) {
- // olt disconnect (not reboot)
- dh1 := newMockDeviceHandler()
- dh1.adapterPreviouslyConnected = false
- dh1.agentPreviouslyConnected = true
+ // olt disconnect (not reboot)
+ dh1 := newMockDeviceHandler()
+ dh1.adapterPreviouslyConnected = false
+ dh1.agentPreviouslyConnected = true
- // adapter restart
- dh2 := newMockDeviceHandler()
- dh2.Client = &mocks.MockOpenoltClient{}
- dh2.adapterPreviouslyConnected = true
- dh2.agentPreviouslyConnected = true
+ // adapter restart
+ dh2 := newMockDeviceHandler()
+ dh2.Client = &mocks.MockOpenoltClient{}
+ dh2.adapterPreviouslyConnected = true
+ dh2.agentPreviouslyConnected = true
- // first connection or olt restart
- dh3 := newMockDeviceHandler()
- dh3.Client = &mocks.MockOpenoltClient{}
- dh3.adapterPreviouslyConnected = false
- dh3.agentPreviouslyConnected = false
+ // first connection or olt restart
+ dh3 := newMockDeviceHandler()
+ dh3.Client = &mocks.MockOpenoltClient{}
+ dh3.adapterPreviouslyConnected = false
+ dh3.agentPreviouslyConnected = false
- // olt and adapter restart at the same time (first case)
- dh4 := newMockDeviceHandler()
- dh4.Client = &mocks.MockOpenoltClient{}
- dh4.adapterPreviouslyConnected = true
- dh4.agentPreviouslyConnected = false
+ // olt and adapter restart at the same time (first case)
+ dh4 := newMockDeviceHandler()
+ dh4.Client = &mocks.MockOpenoltClient{}
+ dh4.adapterPreviouslyConnected = true
+ dh4.agentPreviouslyConnected = false
- // adapter restart and olt disconnect at the same time
- dh5 := newMockDeviceHandler()
- dh5.Client = &mocks.MockOpenoltClient{}
- dh5.adapterPreviouslyConnected = true
- dh5.agentPreviouslyConnected = true
+ // adapter restart and olt disconnect at the same time
+ dh5 := newMockDeviceHandler()
+ dh5.Client = &mocks.MockOpenoltClient{}
+ dh5.adapterPreviouslyConnected = true
+ dh5.agentPreviouslyConnected = true
- tests := []struct {
- name string
- devicehandler *DeviceHandler
- expectedRestart bool
- wantErr bool
- }{
- {"dostateup-1", dh1, true, false},
- {"dostateup-2", dh2, false, false},
- {"dostateup-3", dh3, false, false},
- {"dostateup-4", dh4, true, false},
- {"dostateup-5", dh5, false, false},
+ tests := []struct {
+ name string
+ devicehandler *DeviceHandler
+ expectedRestart bool
+ wantErr bool
+ }{
+ {"dostateup-1", dh1, true, false},
+ {"dostateup-2", dh2, false, false},
+ {"dostateup-3", dh3, false, false},
+ {"dostateup-4", dh4, true, false},
+ {"dostateup-5", dh5, false, false},
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+ if err := tt.devicehandler.doStateUp(ctx); (err != nil) != tt.wantErr {
+ t.Logf("DeviceHandler.doStateUp() error = %v, wantErr %v", err, tt.wantErr)
+ }
+ tt.devicehandler.stopCollector <- true //stop the stat collector invoked from doStateUp
+ isRestarted := tt.devicehandler.Client.(*mocks.MockOpenoltClient).IsRestarted
+ if tt.expectedRestart != isRestarted {
+ t.Errorf("olt-reboot-failed expected= %v, got= %v", tt.expectedRestart, isRestarted)
+ }
+ })
+ }
}
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
- defer cancel()
- if err := tt.devicehandler.doStateUp(ctx); (err != nil) != tt.wantErr {
- t.Logf("DeviceHandler.doStateUp() error = %v, wantErr %v", err, tt.wantErr)
- }
- tt.devicehandler.stopCollector <- true //stop the stat collector invoked from doStateUp
- isRestarted := tt.devicehandler.Client.(*mocks.MockOpenoltClient).IsRestarted
- if tt.expectedRestart != isRestarted {
- t.Errorf("olt-reboot-failed expected= %v, got= %v", tt.expectedRestart, isRestarted)
- }
- })
- }
-}
*/
func Test_UpdateFlowsIncrementallyNegativeTestCases(t *testing.T) {
dh1 := negativeDeviceHandlerNilFlowMgr()