Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
5f4ed048
Commit
5f4ed048
authored
Aug 14, 2018
by
hangaoshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove some unused functions
parent
4492337d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
57 deletions
+0
-57
kubectl.go
test/e2e/kubectl/kubectl.go
+0
-57
No files found.
test/e2e/kubectl/kubectl.go
View file @
5f4ed048
...
...
@@ -26,7 +26,6 @@ import (
"io"
"io/ioutil"
"log"
"mime/multipart"
"net"
"net/http"
"net/http/httptest"
...
...
@@ -1993,21 +1992,6 @@ type updateDemoData struct {
const
applyTestLabel
=
"kubectl.kubernetes.io/apply-test"
func
readBytesFromFile
(
filename
string
)
[]
byte
{
file
,
err
:=
os
.
Open
(
filename
)
if
err
!=
nil
{
framework
.
Failf
(
err
.
Error
())
}
defer
file
.
Close
()
data
,
err
:=
ioutil
.
ReadAll
(
file
)
if
err
!=
nil
{
framework
.
Failf
(
err
.
Error
())
}
return
data
}
func
readReplicationControllerFromString
(
contents
string
)
*
v1
.
ReplicationController
{
rc
:=
v1
.
ReplicationController
{}
if
err
:=
yaml
.
Unmarshal
([]
byte
(
contents
),
&
rc
);
err
!=
nil
{
...
...
@@ -2124,47 +2108,6 @@ func newBlockingReader(s string) (io.Reader, io.Closer, error) {
return
r
,
w
,
nil
}
// newStreamingUpload creates a new http.Request that will stream POST
// a file to a URI.
func
newStreamingUpload
(
filePath
string
)
(
*
io
.
PipeReader
,
*
multipart
.
Writer
,
error
)
{
file
,
err
:=
os
.
Open
(
filePath
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
defer
file
.
Close
()
r
,
w
:=
io
.
Pipe
()
postBodyWriter
:=
multipart
.
NewWriter
(
w
)
go
streamingUpload
(
file
,
filepath
.
Base
(
filePath
),
postBodyWriter
,
w
)
return
r
,
postBodyWriter
,
err
}
// streamingUpload streams a file via a pipe through a multipart.Writer.
// Generally one should use newStreamingUpload instead of calling this directly.
func
streamingUpload
(
file
*
os
.
File
,
fileName
string
,
postBodyWriter
*
multipart
.
Writer
,
w
*
io
.
PipeWriter
)
{
defer
GinkgoRecover
()
defer
file
.
Close
()
defer
w
.
Close
()
// Set up the form file
fileWriter
,
err
:=
postBodyWriter
.
CreateFormFile
(
"file"
,
fileName
)
if
err
!=
nil
{
framework
.
Failf
(
"Unable to write file at %s to buffer. Error: %s"
,
fileName
,
err
)
}
// Copy kubectl binary into the file writer
if
_
,
err
:=
io
.
Copy
(
fileWriter
,
file
);
err
!=
nil
{
framework
.
Failf
(
"Unable to copy file at %s into the file writer. Error: %s"
,
fileName
,
err
)
}
// Nothing more should be written to this instance of the postBodyWriter
if
err
:=
postBodyWriter
.
Close
();
err
!=
nil
{
framework
.
Failf
(
"Unable to close the writer for file upload. Error: %s"
,
err
)
}
}
func
startLocalProxy
()
(
srv
*
httptest
.
Server
,
logs
*
bytes
.
Buffer
)
{
logs
=
&
bytes
.
Buffer
{}
p
:=
goproxy
.
NewProxyHttpServer
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment