示例#1
0
        public void TestUpdateSplit()
        {
            // ARRANGE
            string test2 = @"
<div>
<span class=""yellowfg""> 3:13 PM PDT</span>
&nbsp;We are investigating connectivity issues affecting some instances in a single Availability Zone in the US-EAST-1 Region.\r\n
</div>

<div>
<span class=""yellowfg""> 3:42 PM PDT</span>
&nbsp;We can confirm that there has been an issue in one of the datacenters that makes up one of US-EAST-1 Availability Zones. This was a result of a power event impacting a small percentage of the physical servers in that datacenter as well as some of the networking devices. Customers with EC2 instances in this availability zone may see issues with connectivity to the affected instances. We are seeing recovery and continue to work toward full resolution.
</div>

<div><span class=""yellowfg""> 4:29 PM PDT</span>
&nbsp;We have restored power to the vast majority of the affected instances and continue to work towards full recovery.
</div>

<div>
<span class=""yellowfg""> 5:36 PM PDT</span>
&nbsp;Beginning at 2:52 PM PDT a small percentage of EC2 servers lost power in a single Availability Zone in the US-EAST-1 Region. This resulted in some impaired EC2 instances and degraded performance for some EBS volumes in the affected Availability Zone. Power was restored at 3:22 PM PDT, at which point the vast majority of instances and volumes saw recovery. We have been working to recover the remaining instances and volumes. The small number of remaining instances and volumes are hosted on hardware which was adversely affected by the loss of power. While we will continue to work to recover all affected instances and volumes, for immediate recovery, we recommend replacing any remaining affected instances or volumes if possible.
</div>";

            string test = "<div><span class=\"yellowfg\"> 3:13 PM PDT</span>&nbsp;We are investigating connectivity issues affecting some instances in a single Availability Zone in the US-EAST-1 Region.\r\n</div><div><span class=\"yellowfg\"> 3:42 PM PDT</span>&nbsp;We can confirm that there has been an issue in one of the datacenters that makes up one of US-EAST-1 Availability Zones. This was a result of a power event impacting a small percentage of the physical servers in that datacenter as well as some of the networking devices. Customers with EC2 instances in this availability zone may see issues with connectivity to the affected instances. We are seeing recovery and continue to work toward full resolution.</div><div><span class=\"yellowfg\"> 4:29 PM PDT</span>&nbsp;We have restored power to the vast majority of the affected instances and continue to work towards full recovery.</div><div><span class=\"yellowfg\"> 5:36 PM PDT</span>&nbsp;Beginning at 2:52 PM PDT a small percentage of EC2 servers lost power in a single Availability Zone in the US-EAST-1 Region. This resulted in some impaired EC2 instances and degraded performance for some EBS volumes in the affected Availability Zone. Power was restored at 3:22 PM PDT, at which point the vast majority of instances and volumes saw recovery. We have been working to recover the remaining instances and volumes. The small number of remaining instances and volumes are hosted on hardware which was adversely affected by the loss of power. While we will continue to work to recover all affected instances and volumes, for immediate recovery, we recommend replacing any remaining affected instances or volumes if possible.</div>";

            // ACT
            Dictionary <string, string> dict = EventTimelineUtilities.SplitUpdates(test);

            // ASSERT
            Assert.Equal(4, dict.Count);
        }
示例#2
0
        public void DateNoMismatchTest()
        {
            // ARRANGE
            DashboardEventRaw ev = JsonConvert.DeserializeObject <DashboardEventRaw>(File.ReadAllText("date_no_mismatch.json"));

            // ACT
            DateTime baseDate = EventTimelineUtilities.GetBaseDate(ev);

            // ASSERT
            Assert.Equal(new DateTime(2019, 5, 10, 0, 0, 0, DateTimeKind.Utc), baseDate);
        }
示例#3
0
        public void ReplaceTimeZoneTest()
        {
            // ARRANGE
            string date = "May 5, 5:45 AM PST";

            // ACT
            date = EventTimelineUtilities.ReplaceTimeZoneWithOffset(date);

            // ASSERT
            Assert.Equal("May 5, 5:45 AM -08:00", date);
        }
示例#4
0
        public void TestEvent3()
        {
            // ARRANGE
            DashboardEventRaw data = JsonConvert.DeserializeObject <DashboardEventRaw>(File.ReadAllText("test-event-3.json"));

            // ACT
            EventTimeline startEnd = EventTimelineUtilities.GetEventTimeline(data);

            // ASSERT
            Assert.Equal(new DateTime(2019, 4, 25, 16, 11, 0, DateTimeKind.Utc), startEnd.Start);
            Assert.Equal(new DateTime(2019, 4, 25, 19, 13, 0, DateTimeKind.Utc), startEnd.End);
        }
示例#5
0
        public void DateMismatchTest()
        {
            // ARRANGE
            DashboardEventRaw ev = JsonConvert.DeserializeObject <DashboardEventRaw>(File.ReadAllText("date_mismatch.json"));
            DateTime          dt = ServiceUtilities.ConvertFromUnixTimestamp(Int64.Parse(ev.Date));

            // ACT
            DateTime baseDate = EventTimelineUtilities.GetBaseDate(ev);

            // ASSERT
            Assert.Equal(new DateTime(2019, 5, 10, 0, 0, 0, DateTimeKind.Utc), baseDate);
            Assert.NotEqual(dt.Day, baseDate.Day);
        }
示例#6
0
        public void SimpleBetweenXandYRegex()
        {
            // ARRANGE
            // Tue May 15 2018 15:12:21 GMT+0000
            // Between 5:27 AM and 8:17 AM PDT, 7 hours difference
            DateTime start = new DateTime(2018, 5, 15, 12, 27, 0, DateTimeKind.Utc);
            DateTime end   = new DateTime(2018, 5, 15, 15, 17, 0, DateTimeKind.Utc);

            DashboardEventRaw ev = JsonConvert.DeserializeObject <DashboardEventRaw>(File.ReadAllText("ec2-us-east-1.json"));

            // ACT
            EventTimeline startEnd = EventTimelineUtilities.GetEventTimeline(ev);

            // ASSERT
            Assert.Equal(start, startEnd.Start);
            Assert.Equal(end, startEnd.End);
        }
示例#7
0
        public void ComplexBetweenXandY()
        {
            // ARRANGE
            // Wed Aug 08 2018 10:02:04 GMT+0000
            // Between 5:10 PM on August 7th, and 3:50 AM PDT on August 8th, 7 hours difference
            DateTime start = new DateTime(2018, 8, 8, 0, 10, 0, DateTimeKind.Utc);
            DateTime end   = new DateTime(2018, 8, 8, 10, 50, 0, DateTimeKind.Utc);

            DashboardEventRaw ev = JsonConvert.DeserializeObject <DashboardEventRaw>(File.ReadAllText("emr-ap-south-1.json"));

            // ACT
            EventTimeline startEnd = EventTimelineUtilities.GetEventTimeline(ev);

            // ASSERT
            Assert.Equal(start, startEnd.Start);
            Assert.Equal(end, startEnd.End);
        }
示例#8
0
        public void TestAllData()
        {
            // ARRANGE
            DashboardEventData data = JsonConvert.DeserializeObject <DashboardEventData>(File.ReadAllText("data.json"));

            File.WriteAllText("misses.json", "[");

            int success   = 0;
            int unhandled = 0;

            List <EventTimeline> timelines = new List <EventTimeline>();

            // ACT
            foreach (DashboardEventRaw ev in data.Archive)
            {
                try
                {
                    EventTimeline evTimeline = EventTimelineUtilities.GetEventTimeline(ev);
                    timelines.Add(evTimeline);
                    success += 1;

                    if (evTimeline.EndTimeWasFoundInDescription == false)
                    {
                        File.AppendAllText("misses.json", JsonConvert.SerializeObject(ev));
                    }
                }
                catch (Exception e)
                {
                    unhandled += 1;
                }
            }

            File.AppendAllText("misses.json", "]");

            // ASSERT
            Assert.Equal(data.Archive.Count(), success);
            Assert.Equal(0, unhandled);
        }