This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func newTestK8s() *k8s { | |
client := k8s{ | |
clientset: &fake.Clientset{}, | |
} | |
return &client | |
} | |
func TestCanICreateDeploymentsFalse(t *testing.T) { | |
k8s := newTestSimpleK8s() | |
c, err := k8s.canICreateDeployments() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (o *k8s) canICreateDeployments() (bool, error) { | |
ssar := &authorizationv1.SelfSubjectAccessReview{ | |
Spec: authorizationv1.SelfSubjectAccessReviewSpec{ | |
ResourceAttributes: &authorizationv1.ResourceAttributes{ | |
Verb: "create", | |
Resource: "deployments", | |
}, | |
}, | |
} | |
ssar, err := o.clientset.AuthorizationV1().SelfSubjectAccessReviews().Create(ssar) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestIsVersionOK(t *testing.T) { | |
expectedMajor := "1" | |
expectedMinor := "9" | |
k8s := newTestSimpleK8s() | |
k8s.clientset.Discovery().(*discoveryfake.FakeDiscovery).FakedServerVersion = &version.Info{ | |
Major: expectedMajor, | |
Minor: expectedMinor, | |
} | |
v, err := k8s.isVersion(expectedMajor, expectedMinor) | |
if err != nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (o *k8s) isVersion(major string, minor string) (bool, error) { | |
version, err := o.clientset.Discovery().ServerVersion() | |
if err != nil { | |
return false, err | |
} | |
if version.Major != major { | |
return false, errors.New("Major version does not match") | |
} | |
if version.Minor != minor { | |
return false, errors.New("Minor version does not match") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"testing" | |
"k8s.io/client-go/kubernetes/fake" | |
) | |
func newTestSimpleK8s() *k8s { | |
client := k8s{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"k8s.io/client-go/kubernetes" | |
"k8s.io/client-go/tools/clientcmd" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"k8s.io/client-go/kubernetes" | |
"k8s.io/client-go/tools/clientcmd" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DOMAIN valid_password | |
AS text | |
CHECK(7 < char_length(VALUE) | |
AND 2 < char_length( COALESCE(substring(VALUE from '[^a-zA-Z0-9]'), '') | |
|| COALESCE(substring(VALUE from '[0-9]'), '') | |
|| COALESCE(substring(VALUE from '[A-Z]'), '') | |
|| COALESCE(substring(VALUE from '[a-z]'), ''))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
if [[ -n "$1" ]]; then | |
N=$1 | |
else | |
N=1 | |
fi | |
FEMININE_FIRSTS=feminine_firsts.txt | |
MASCULINE_FIRSTS=masculine_firsts.txt | |
LASTS=lasts.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
echo $(cat feminine_firsts.txt masculine_firsts.txt | shuf -n 1)" "$(shuf -n 1 lasts.txt) |
NewerOlder