Ejemplo n.º 1
0
 public void should_not_have_called_executable_process()
 {
     Setup();
     SetProviderData.Execute(ProviderData);
     ExecutableProcessQueue.AssertWasNotCalled(
         queue => queue.Enqueue(Arg <string> .Is.Equal("netsh"), Arg <string> .Is.Anything));
     Logger.AssertWasCalled(l => l.Log("Role Names did not match. Roles names from provider data fake role1,fake role2. Role names from configuration rax_managed,rack_connect"));
 }
Ejemplo n.º 2
0
        public void should_have_called_executable_process_when_firewall_rule_is_available_with_metadata()
        {
            Setup();
            NetshFirewallRuleNameAvailable.Stub(x => x.IsRuleAvailable(Constants.SoftwareFirewallRuleName)).Return(true);

            UserMetadata.Add("build_config");
            SetProviderData.Execute(ProviderData, UserMetadata);
            ExecutableProcessQueue.AssertWasCalled(
                queue => queue.Enqueue("netsh", "advfirewall firewall set rule name=\"RS_FIREWALL_RULE\" new enable=yes remoteip=10.177.212.96,10.181.136.241,10.176.89.224,10.177.212.79"));
        }
Ejemplo n.º 3
0
        public void should_have_called_executable_process_when_firewall_rule_is_not_available()
        {
            Setup();
            NetshFirewallRuleNameAvailable.Stub(x => x.IsRuleAvailable(Constants.SoftwareFirewallRuleName)).Return(false);
            ProviderData.roles = new List <string>()
            {
                "rax_managed", "rack_connect"
            };

            SetProviderData.Execute(ProviderData);
            ExecutableProcessQueue.AssertWasCalled(
                queue => queue.Enqueue("netsh", "advfirewall firewall add rule name=\"RS_FIREWALL_RULE\" enable=yes dir=in profile=public,private,domain localip=any remoteip=10.177.212.96,10.181.136.241,10.176.89.224,10.177.212.79 protocol=tcp localport=445 remoteport=any edge=no action=allow"));
        }
Ejemplo n.º 4
0
        public void should_have_called_executable_process_when_firewall_rule_is_available()
        {
            Setup();
            NetshFirewallRuleNameAvailable.Stub(x => x.IsRuleAvailable(Constants.SoftwareFirewallRuleName)).Return(true);

            ProviderData.roles = new List <string>()
            {
                "rax_managed", "rack_connect"
            };
            SetProviderData.Execute(ProviderData);
            ExecutableProcessQueue.AssertWasCalled(
                queue => queue.Enqueue("netsh", "advfirewall firewall set rule name=\"RS_FIREWALL_RULE\" new enable=yes remoteip=10.177.212.96,10.181.136.241,10.176.89.224,10.177.212.79"));
        }
Ejemplo n.º 5
0
        public void should_not_have_called_executable_process_because_white_list_ips_count_is_less_than_zero()
        {
            Setup();

            ProviderData.white_List_Ips = new List <string>();
            ProviderData.roles          = new List <string>()
            {
                "rax_managed", "rack_connect"
            };

            SetProviderData.Execute(ProviderData);
            ExecutableProcessQueue.AssertWasNotCalled(
                queue => queue.Enqueue(Arg <string> .Is.Equal("netsh"), Arg <string> .Is.Anything));
            Logger.AssertWasCalled(l => l.Log("White List Ips not available. Firewall rules will not be added/updated."));
        }