Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restik unit test, e2e test #14

Merged
merged 7 commits into from Mar 22, 2017

Conversation

Projects
None yet
3 participants
@saumanbiswas
Copy link
Contributor

commented Mar 21, 2017

No description provided.

@@ -14,9 +14,9 @@ type FakeBackup struct {
ns string
}

var certResource = schema.GroupVersionResource{Group: "appscode.com", Version: "v1beta1", Resource: "certificates"}
var certResource = schema.GroupVersionResource{Group: "appscode.com", Version: "v1beta1", Resource: "backups"}

This comment has been minimized.

Copy link
@sadlil

sadlil Mar 22, 2017

Contributor

Change the variable name.

@@ -587,7 +580,7 @@ func execLocal(s string) (string, error) {
return strings.TrimSuffix(string(cmdOut), "\n"), err
}

func getPasswordFromSecret(client *internalclientset.Clientset, secretName, namespace string) (string, error) {
func getPasswordFromSecret(client *clientset.Clientset, secretName, namespace string) (string, error) {

This comment has been minimized.

Copy link
@sadlil

sadlil Mar 22, 2017

Contributor

Isn't clientset.ClientSet is interface?

This comment has been minimized.

Copy link
@sadlil

sadlil Mar 22, 2017

Contributor

use the interface. so this file can also be unit testable.

)

func runController() (*controller.Controller, error) {
config, err := clientcmd.BuildConfigFromFlags("", "/home/sauman/.kube/config")

This comment has been minimized.

Copy link
@sadlil

sadlil Mar 22, 2017

Contributor

you can't point your pc specific config. What if i try to run those test in my machine?

}
defer deleteReplicaset(watcher, rs)
time.Sleep(time.Second * 30)
fmt.Println("Starting backup for Replicaset...")

This comment has been minimized.

Copy link
@sadlil

sadlil Mar 22, 2017

Contributor

all print should be done using log not fmt.Println()

"log"
)

var namespace = "sauman"

This comment has been minimized.

Copy link
@sadlil

sadlil Mar 22, 2017

Contributor

try creating a random.

var ns = Rand()

func (c *FakeExtensionClient) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret

This comment has been minimized.

Copy link
@sadlil

sadlil Mar 22, 2017

Contributor

You are not specifically setting the value. why not send nil?

@saumanbiswas saumanbiswas requested a review from tamalsaha Mar 22, 2017

@tamalsaha

This comment has been minimized.

Copy link
Contributor

commented Mar 22, 2017

@saumanbiswas add constants like below ad use them

const (
	ResourceKindBackup = "Backup"
	ResourceNameBackup = "backup"
	ResourceTypeBackup = "backups"
)
@sadlil

sadlil approved these changes Mar 22, 2017

@sadlil

This comment has been minimized.

Copy link
Contributor

commented Mar 22, 2017

LGTM

@tamalsaha tamalsaha merged commit fb8e6c1 into master Mar 22, 2017

@tamalsaha tamalsaha deleted the restik_fake_test branch Mar 22, 2017

tamalsaha added a commit that referenced this pull request Jan 25, 2018

Squashed 'hack/libbuild/' changes from 4c4d915..81dd735
81dd735 only update canary tags for images built from master branch (#14)
c21c481 Switch to GO 1.9.3
f0faa64 Remove `-it` from docker builds
430a90b Use kiteci/golang:1.9.2-alpine image
fc9db85 Add kiteci.sh
55918b9 Add pharmer script
d8ec9c7 Update to go 1.9.2 alpine image

git-subtree-dir: hack/libbuild
git-subtree-split: 81dd7359132dd2096f09088aed4472e153ed121e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.