Beispiel #1
0
        public void TestNeedsRequests(string items, string active)
        {
            var dict = items.Split(';').Select(i =>
            {
                var splits = i.Split(':');
                return(new KeyValuePair <string, string>(splits[0], splits[1].TrimStart()));
            }).ToDictionary(i => i.Key, i => i.Value);

            var activeRequests = active.Split(';');

            var podRequestInfo = new PodDataRequestInfo(new PodIdentifier("a", "b"), dict);

            foreach (var reqName in activeRequests.Where(r => !string.IsNullOrEmpty(r)))
            {
                Assert.IsFalse(podRequestInfo.Requests.Keys.Any(r => r == reqName));
            }
        }
Beispiel #2
0
            private bool PodIsOnVersionForAtLeast(PodDataRequestInfo p, string repoSpec, DataDownloadRequestDetails ver, TimeSpan?timespan)
            {
                var request = p.Requests.FirstOrDefault(r => r.Key == repoSpec).Value;

                if (request is not null)
                {
                    var version = DataDownloadRequestDetails.FromBase64Json(request);
                    if (version != null && version.Equals(ver))
                    {
                        if (!timespan.HasValue)
                        {
                            return(true);
                        }
                        else
                        {
                            return(version.UnixTimestampSeconds < (this.clock.Get() - timespan.Value).ToUnixTimeSeconds());
                        }
                    }
                }

                return(false);
            }