mirror of
				https://github.com/appleboy/drone-ssh.git
				synced 2025-10-29 00:51:15 +08:00 
			
		
		
		
	fix: testing
This commit is contained in:
		
							parent
							
								
									e10d8736d4
								
							
						
					
					
						commit
						1ed9685484
					
				| @ -383,15 +383,15 @@ func TestCommandOutput(t *testing.T) { | |||||||
| 	assert.Equal(t, unindent(expected), unindent(buffer.String())) | 	assert.Equal(t, unindent(expected), unindent(buffer.String())) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestCommandScriptStop(t *testing.T) { | func TestScriptStop(t *testing.T) { | ||||||
| 	var ( | 	var ( | ||||||
| 		buffer   bytes.Buffer | 		buffer   bytes.Buffer | ||||||
| 		expected = ` | 		expected = ` | ||||||
| 			localhost: ======CMD====== | 			======CMD====== | ||||||
| 			localhost: mkdir a/b/c | 			mkdir a/b/c | ||||||
| 			mkdir d/e/f | 			mkdir d/e/f | ||||||
| 			localhost: ======END====== | 			======END====== | ||||||
| 			localhost: err: mkdir: d/e: No such file or directory | 			err: mkdir: can't create directory 'a/b/c': No such file or directory | ||||||
| 		` | 		` | ||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
| @ -417,6 +417,40 @@ func TestCommandScriptStop(t *testing.T) { | |||||||
| 	assert.Equal(t, unindent(expected), unindent(buffer.String())) | 	assert.Equal(t, unindent(expected), unindent(buffer.String())) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func TestNoneScriptStop(t *testing.T) { | ||||||
|  | 	var ( | ||||||
|  | 		buffer   bytes.Buffer | ||||||
|  | 		expected = ` | ||||||
|  | 			======CMD====== | ||||||
|  | 			mkdir a/b/c | ||||||
|  | 			mkdir d/e/f | ||||||
|  | 			======END====== | ||||||
|  | 			err: mkdir: can't create directory 'a/b/c': No such file or directory | ||||||
|  | 			err: mkdir: can't create directory 'd/e/f': No such file or directory | ||||||
|  | 		` | ||||||
|  | 	) | ||||||
|  | 
 | ||||||
|  | 	plugin := Plugin{ | ||||||
|  | 		Config: Config{ | ||||||
|  | 			Host:     []string{"localhost"}, | ||||||
|  | 			UserName: "drone-scp", | ||||||
|  | 			Port:     22, | ||||||
|  | 			KeyPath:  "./tests/.ssh/id_rsa", | ||||||
|  | 			Script: []string{ | ||||||
|  | 				"mkdir a/b/c", | ||||||
|  | 				"mkdir d/e/f", | ||||||
|  | 			}, | ||||||
|  | 			CommandTimeout: 10, | ||||||
|  | 		}, | ||||||
|  | 		Writer: &buffer, | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	err := plugin.Exec() | ||||||
|  | 	assert.Nil(t, err) | ||||||
|  | 
 | ||||||
|  | 	assert.Equal(t, unindent(expected), unindent(buffer.String())) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func TestEnvOutput(t *testing.T) { | func TestEnvOutput(t *testing.T) { | ||||||
| 	var ( | 	var ( | ||||||
| 		buffer   bytes.Buffer | 		buffer   bytes.Buffer | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Bo-Yi Wu
						Bo-Yi Wu