/// <summary> /// Polls the index until wither time runs down, or the event count /// matches the desired value. /// </summary> /// <param name="index">The index</param> /// <param name="value">The desired event count value</param> /// <param name="seconds">The number seconds to poll</param> private static void WaitUntilEventCount(Index index, int value, int seconds) { while (seconds > 0) { Thread.Sleep(1000); // 1000ms (1 second sleep) seconds = seconds - 1; index.Refresh(); var count = index.TotalEventCount; if (count == value) { return; } } Assert.Fail("Count did not reach the expected in alloted time."); }
/// <summary> /// Gets old values from given index, skip saving paths and things we cannot write /// </summary> /// <param name="index">The Index</param> /// <returns>The argument getIndexProperties</returns> private Args GetIndexProperties(Index index) { Args indexProperties = new Args(); indexProperties.Add("blockSignSize", index.BlockSignSize); indexProperties.Add("frozenTimePeriodInSecs", index.FrozenTimePeriodInSecs); indexProperties.Add("maxConcurrentOptimizes", index.MaxConcurrentOptimizes); indexProperties.Add("maxDataSize", index.MaxDataSize); indexProperties.Add("maxHotBuckets", index.MaxHotBuckets); indexProperties.Add("maxHotIdleSecs", index.MaxHotIdleSecs); indexProperties.Add("maxHotSpanSecs", index.MaxHotSpanSecs); indexProperties.Add("maxMemMB", index.MaxMemMB); indexProperties.Add("maxMetaEntries", index.MaxMetaEntries); indexProperties.Add("maxTotalDataSizeMB", index.MaxTotalDataSizeMB); indexProperties.Add("maxWarmDBCount", index.MaxWarmDBCount); indexProperties.Add("minRawFileSyncSecs", index.MinRawFileSyncSecs); indexProperties.Add("partialServiceMetaPeriod", index.PartialServiceMetaPeriod); indexProperties.Add("quarantineFutureSecs", index.QuarantineFutureSecs); indexProperties.Add("quarantinePastSecs", index.QuarantinePastSecs); indexProperties.Add("rawChunkSizeBytes", index.RawChunkSizeBytes); indexProperties.Add("rotatePeriodInSecs", index.RotatePeriodInSecs); indexProperties.Add("serviceMetaPeriod", index.ServiceMetaPeriod); indexProperties.Add("syncMeta", index.SyncMeta); indexProperties.Add("throttleCheckPeriod", index.ThrottleCheckPeriod); return indexProperties; }
/// <summary> /// Clear the index /// </summary> /// <param name="service">A service</param> /// <param name="indexName">The index name</param> /// <param name="index">The index object</param> private void ClearIndex(Service service, string indexName, Index index) { service.Oneshot(string.Format("search index={0} * | delete", indexName)); WaitUntilEventCount(index, 0, 45); }