// Mock PushLocal to collect changed files and compare against expected changed files
Mock PushLocal to collect changed files and compare against expected changed files
// Mock PushLocal to collect changed files and compare against expected changed files
func mockPushLocal(client *occlient.Client, componentName string, applicationName string, path string, out io.Writer, files []string) error {
	for _, gotChangedFile := range files {
		found := false
		for _, expChangedFile := range ExpectedChangedFiles {
			wantedFileDetail := CompDirStructure[expChangedFile]
			if filepath.Join(wantedFileDetail.FileParent, wantedFileDetail.FilePath) == gotChangedFile {
				found = true
				ExtChan <- true
				return nil
			}
		}
		if !found {
			ExtChan <- true
			return fmt.Errorf("received %+v which is not same as expected list %+v", files, ExpectedChangedFiles)
		}
	}
	return nil
}
func mockPushLocal ( client * occlient . Client , componentName string , applicationName string , path string , out io . Writer , files [ ] string ) error { for _ , gotChangedFile := range files { found := false for _ , expChangedFile := range ExpectedChangedFiles { wantedFileDetail := CompDirStructure [ expChangedFile ] if filepath . Join ( wantedFileDetail . FileParent , wantedFileDetail . FilePath ) == gotChangedFile { found = true ExtChan <- true return nil } } if ! found { ExtChan <- true return fmt . Errorf ( " " , files , ExpectedChangedFiles ) } } return nil }
Mock PushLocal to collect changed files and compare against expected changed files
Mock PushLocal to collect changed files and compare against expected changed files
// Verify every file in expected file changes to be actually observed to be changed // If found exactly same or different, return from PushLocal and signal exit for watch so that the watch terminates gracefully