Test with CompareDest set
(t *testing.T)
| 2096 | |
| 2097 | // Test with CompareDest set |
| 2098 | func TestSyncCompareDest(t *testing.T) { |
| 2099 | ctx := context.Background() |
| 2100 | ctx, ci := fs.AddConfig(ctx) |
| 2101 | r := fstest.NewRun(t) |
| 2102 | |
| 2103 | ci.CompareDest = []string{r.FremoteName + "/CompareDest"} |
| 2104 | |
| 2105 | fdst, err := fs.NewFs(ctx, r.FremoteName+"/dst") |
| 2106 | require.NoError(t, err) |
| 2107 | |
| 2108 | // check empty dest, empty compare |
| 2109 | file1 := r.WriteFile("one", "one", t1) |
| 2110 | r.CheckLocalItems(t, file1) |
| 2111 | |
| 2112 | accounting.GlobalStats().ResetCounters() |
| 2113 | // ctx = predictDstFromLogger(ctx) // not currently supported due to duplicate equal() checks |
| 2114 | err = Sync(ctx, fdst, r.Flocal, false) |
| 2115 | // testLoggerVsLsf(ctx, fdst, operations.GetLoggerOpt(ctx).JSON, t) |
| 2116 | require.NoError(t, err) |
| 2117 | |
| 2118 | file1dst := file1 |
| 2119 | file1dst.Path = "dst/one" |
| 2120 | |
| 2121 | r.CheckRemoteItems(t, file1dst) |
| 2122 | |
| 2123 | // check old dest, empty compare |
| 2124 | file1b := r.WriteFile("one", "onet2", t2) |
| 2125 | r.CheckRemoteItems(t, file1dst) |
| 2126 | r.CheckLocalItems(t, file1b) |
| 2127 | |
| 2128 | accounting.GlobalStats().ResetCounters() |
| 2129 | // ctx = predictDstFromLogger(ctx) |
| 2130 | err = Sync(ctx, fdst, r.Flocal, false) |
| 2131 | // testLoggerVsLsf(ctx, fdst, operations.GetLoggerOpt(ctx).JSON, t) |
| 2132 | require.NoError(t, err) |
| 2133 | |
| 2134 | file1bdst := file1b |
| 2135 | file1bdst.Path = "dst/one" |
| 2136 | |
| 2137 | r.CheckRemoteItems(t, file1bdst) |
| 2138 | |
| 2139 | // check old dest, new compare |
| 2140 | file3 := r.WriteObject(ctx, "dst/one", "one", t1) |
| 2141 | file2 := r.WriteObject(ctx, "CompareDest/one", "onet2", t2) |
| 2142 | file1c := r.WriteFile("one", "onet2", t2) |
| 2143 | r.CheckRemoteItems(t, file2, file3) |
| 2144 | r.CheckLocalItems(t, file1c) |
| 2145 | |
| 2146 | accounting.GlobalStats().ResetCounters() |
| 2147 | // ctx = predictDstFromLogger(ctx) |
| 2148 | err = Sync(ctx, fdst, r.Flocal, false) |
| 2149 | // testLoggerVsLsf(ctx, fdst, operations.GetLoggerOpt(ctx).JSON, t) |
| 2150 | require.NoError(t, err) |
| 2151 | |
| 2152 | r.CheckRemoteItems(t, file2, file3) |
| 2153 | |
| 2154 | // check empty dest, new compare |
| 2155 | file4 := r.WriteObject(ctx, "CompareDest/two", "two", t2) |
nothing calls this directly
no test coverage detected
searching dependent graphs…